diff --git a/.clang-format b/.clang-format index 5e9229b265d..7bd9e25b131 100644 --- a/.clang-format +++ b/.clang-format @@ -3,13 +3,13 @@ Language: Cpp # BasedOnStyle: Google AccessModifierOffset: -4 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false +AlignConsecutiveAssignments: None +AlignConsecutiveDeclarations: None AlignEscapedNewlines: Left AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false +AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: All AllowShortIfStatementsOnASingleLine: true @@ -17,12 +17,12 @@ AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: true +AlwaysBreakTemplateDeclarations: Yes BinPackArguments: true BinPackParameters: true BraceWrapping: AfterClass: false - AfterControlStatement: false + AfterControlStatement: Never AfterEnum: false AfterFunction: true AfterNamespace: false @@ -88,7 +88,7 @@ PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Left ReflowComments: true -SortIncludes: true +SortIncludes: CaseInsensitive SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterTemplateKeyword: true @@ -101,7 +101,7 @@ SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: Cpp11 +Standard: c++14 TabWidth: 8 UseTab: Never ... diff --git a/.github/bot-pr-format-base.sh b/.github/bot-pr-format-base.sh index 53685f680f5..edac3ddc7ee 100644 --- a/.github/bot-pr-format-base.sh +++ b/.github/bot-pr-format-base.sh @@ -1,24 +1,25 @@ #!/usr/bin/env bash -source .github/bot-pr-base.sh +cp .github/bot-pr-base.sh /tmp +source /tmp/bot-pr-base.sh -echo "Retrieving PR file list" -PR_FILES=$(bot_get_all_changed_files ${PR_URL}) -NUM=$(echo "${PR_FILES}" | wc -l) -echo "PR has ${NUM} changed files" - -TO_FORMAT="$(echo "$PR_FILES" | grep -E $EXTENSION_REGEX || true)" +echo "Set-up working tree" git remote add fork "$HEAD_URL" git fetch fork "$HEAD_BRANCH" +git fetch origin "$BASE_BRANCH" + +# checkout current PR head +LOCAL_BRANCH=format-tmp-$HEAD_BRANCH +git checkout -b $LOCAL_BRANCH fork/$HEAD_BRANCH git config user.email "ginkgo.library@gmail.com" git config user.name "ginkgo-bot" # save scripts from develop -pushd dev_tools/scripts +pushd dev_tools/scripts || exit 1 cp add_license.sh format_header.sh update_ginkgo_header.sh /tmp -popd +popd || exit 1 # checkout current PR head LOCAL_BRANCH=format-tmp-$HEAD_BRANCH @@ -28,12 +29,3 @@ git checkout -b $LOCAL_BRANCH fork/$HEAD_BRANCH cp /tmp/add_license.sh dev_tools/scripts/ cp /tmp/format_header.sh dev_tools/scripts/ cp /tmp/update_ginkgo_header.sh dev_tools/scripts/ - -# format files -dev_tools/scripts/add_license.sh -dev_tools/scripts/update_ginkgo_header.sh -for f in $(echo "$TO_FORMAT" | grep -E $FORMAT_HEADER_REGEX); do dev_tools/scripts/format_header.sh "$f"; done -for f in $(echo "$TO_FORMAT" | grep -E $FORMAT_REGEX); do "$CLANG_FORMAT" -i -style=file "$f"; done - -# restore formatting scripts so they don't appear in the diff -git checkout -- dev_tools/scripts/*.sh diff --git a/.github/check-format.sh b/.github/check-format.sh index 96e3ea3616b..9810fa035ca 100755 --- a/.github/check-format.sh +++ b/.github/check-format.sh @@ -3,13 +3,22 @@ cp .github/bot-pr-format-base.sh /tmp source /tmp/bot-pr-format-base.sh +echo -n "Run Pre-Commit checks" + +pipx run pre-commit run --show-diff-on-failure --color=always --from-ref "origin/$BASE_BRANCH" --to-ref HEAD || true + +echo -n "Collecting information on changed files" + # check for changed files, replace newlines by \n LIST_FILES=$(git diff --name-only | sed '$!s/$/\\n/' | tr -d '\n') +echo -n . git diff > /tmp/format.patch mv /tmp/format.patch . +echo -n . bot_delete_comments_matching "Error: The following files need to be formatted" +echo -n . if [[ "$LIST_FILES" != "" ]]; then MESSAGE="The following files need to be formatted:\n"'```'"\n$LIST_FILES\n"'```' @@ -17,3 +26,4 @@ if [[ "$LIST_FILES" != "" ]]; then MESSAGE="$MESSAGE($JOB_URL) or run "'`format!` if you have write access to Ginkgo' bot_error "$MESSAGE" fi +echo . diff --git a/.github/format-rebase.sh b/.github/format-rebase.sh index 9bd497ce3b6..8ee410eebbf 100755 --- a/.github/format-rebase.sh +++ b/.github/format-rebase.sh @@ -1,25 +1,7 @@ #!/usr/bin/env bash -source .github/bot-pr-base.sh - -git remote add base "$BASE_URL" -git remote add fork "$HEAD_URL" - -git remote -v - -git fetch base $BASE_BRANCH -git fetch fork $HEAD_BRANCH - -git config user.email "$USER_EMAIL" -git config user.name "$USER_NAME" - -LOCAL_BRANCH=rebase-tmp-$HEAD_BRANCH -git checkout -b $LOCAL_BRANCH fork/$HEAD_BRANCH - -# save scripts from develop -pushd dev_tools/scripts -cp add_license.sh format_header.sh update_ginkgo_header.sh /tmp -popd +cp .github/bot-pr-format-base.sh /tmp +source /tmp/bot-pr-format-base.sh bot_delete_comments_matching "Error: Rebase failed" @@ -30,7 +12,7 @@ git rebase --rebase-merges --empty=drop --no-keep-empty \ --exec "cp /tmp/add_license.sh /tmp/format_header.sh /tmp/update_ginkgo_header.sh dev_tools/scripts/ && \ dev_tools/scripts/add_license.sh && dev_tools/scripts/update_ginkgo_header.sh && \ for f in \$($DIFF_COMMAND | grep -E '$FORMAT_HEADER_REGEX'); do dev_tools/scripts/format_header.sh \$f; done && \ - for f in \$($DIFF_COMMAND | grep -E '$FORMAT_REGEX'); do $CLANG_FORMAT -i \$f; done && \ + pipx run pre-commit run && \ git checkout dev_tools/scripts && (git diff >> /tmp/difflog; true) && (git diff --quiet || git commit -a --amend --no-edit --allow-empty)" \ base/$BASE_BRANCH 2>&1 || bot_error "Rebase failed, see the related [Action]($JOB_URL) for details" diff --git a/.github/format.sh b/.github/format.sh index 796daaeaf2d..c1aeb700588 100755 --- a/.github/format.sh +++ b/.github/format.sh @@ -3,11 +3,29 @@ cp .github/bot-pr-format-base.sh /tmp source /tmp/bot-pr-format-base.sh +echo "Retrieving PR file list" +PR_FILES=$(bot_get_all_changed_files ${PR_URL}) +NUM=$(echo "${PR_FILES}" | wc -l) +echo "PR has ${NUM} changed files" + +TO_FORMAT="$(echo "$PR_FILES" | grep -E $EXTENSION_REGEX || true)" + +# format files +dev_tools/scripts/add_license.sh +dev_tools/scripts/update_ginkgo_header.sh +for f in $(echo "$TO_FORMAT" | grep -E $FORMAT_HEADER_REGEX); do dev_tools/scripts/format_header.sh "$f"; done +pipx run pre-commit run --files $TO_FORMAT || true + +# restore formatting scripts so they don't appear in the diff +git checkout -- dev_tools/scripts/*.sh + # check for changed files, replace newlines by \n -LIST_FILES=$(git diff --name-only | sed '$!s/$/\\n/' | tr -d '\n') +CHANGES=$(git diff --name-only | sed '$!s/$/\\n/' | tr -d '\n') + +echo "$CHANGES" # commit changes if necessary -if [[ "$LIST_FILES" != "" ]]; then +if [[ "$CHANGES" != "" ]]; then git commit -a -m "Format files Co-authored-by: $USER_COMBINED" diff --git a/.github/workflows/bot-pr-comment.yml b/.github/workflows/bot-pr-comment.yml index acc33d1ad0d..dbc8a3d4b18 100644 --- a/.github/workflows/bot-pr-comment.yml +++ b/.github/workflows/bot-pr-comment.yml @@ -1,46 +1,35 @@ +name: OnCommentPR + on: issue_comment: types: [created] -name: OnCommentPR + jobs: label: runs-on: ubuntu-latest if: github.event.issue.pull_request != '' && github.event.comment.body == 'label!' && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop - name: Add appropriate labels env: GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} run: cp --preserve .github/label.sh /tmp && /tmp/label.sh + check_format: name: check-format - runs-on: ubuntu-22.04 if: github.event.issue.pull_request != '' && github.event.comment.body == 'check-format!' && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') - steps: - - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 - with: - ref: develop - - name: Check for formatting changes - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - run: cp --preserve .github/check-format.sh /tmp && /tmp/check-format.sh - - name: Upload code formatting patch - if: failure() - uses: actions/upload-artifact@v3 - with: - name: patch - path: format.patch + uses: ./.github/workflows/check-formatting.yml + format: name: format runs-on: ubuntu-22.04 if: github.event.issue.pull_request != '' && github.event.comment.body == 'format!' && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop persist-credentials: false @@ -48,13 +37,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} run: cp --preserve .github/format.sh /tmp && /tmp/format.sh + rebase: name: rebase if: github.event.issue.pull_request != '' && github.event.comment.body == 'rebase!' && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop fetch-depth: 0 @@ -63,13 +53,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} run: cp --preserve .github/rebase.sh /tmp && /tmp/rebase.sh + format-rebase: name: format-rebase if: github.event.issue.pull_request != '' && github.event.comment.body == 'format-rebase!' && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') runs-on: ubuntu-22.04 steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop fetch-depth: 0 diff --git a/.github/workflows/bot-pr-created.yml b/.github/workflows/bot-pr-created.yml index ce33aba9ce2..21fb0b3ca14 100644 --- a/.github/workflows/bot-pr-created.yml +++ b/.github/workflows/bot-pr-created.yml @@ -8,7 +8,7 @@ jobs: if: github.event.pull_request.author_association == 'COLLABORATOR' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'OWNER' steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop - name: Add appropriate labels diff --git a/.github/workflows/bot-pr-updated.yml b/.github/workflows/bot-pr-updated.yml index 8554ca3b1e9..eb89cc9429f 100644 --- a/.github/workflows/bot-pr-updated.yml +++ b/.github/workflows/bot-pr-updated.yml @@ -1,29 +1,18 @@ +name: OnSyncPR + on: pull_request_target: types: [opened,synchronize] -name: OnSyncPR + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} cancel-in-progress: true + jobs: check-format: - runs-on: ubuntu-22.04 if: github.event.pull_request.author_association == 'COLLABORATOR' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'OWNER' - steps: - - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 - with: - ref: develop - - name: Check for formatting changes - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - run: cp .github/check-format.sh /tmp && /tmp/check-format.sh - - name: Upload code formatting patch - if: failure() - uses: actions/upload-artifact@v3 - with: - name: patch - path: format.patch + uses: ./.github/workflows/check-formatting.yml + abidiff: runs-on: ubuntu-latest if: github.event.pull_request.author_association == 'COLLABORATOR' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'OWNER' @@ -31,12 +20,12 @@ jobs: CMAKE_FLAGS: -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=DEBUG -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -DGINKGO_BUILD_HWLOC=OFF -DGINKGO_BUILD_REFERENCE=OFF -DGINKGO_BUILD_OMP=OFF -DGINKGO_BUILD_CUDA=OFF -DGINKGO_BUILD_HIP=OFF -DGINKGO_BUILD_SYCL=OFF steps: - name: Checkout the new code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: new ref: ${{ github.event.pull_request.head.ref }} - name: Checkout the old code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: old ref: ${{ github.event.pull_request.base.ref }} @@ -58,14 +47,15 @@ jobs: if: failure() uses: actions/upload-artifact@v3 with: - name: abi - path: abi.diff + name: abi + path: abi.diff + check-wiki-changelog: runs-on: ubuntu-latest if: github.event.pull_request.author_association == 'COLLABORATOR' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'OWNER' steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop - name: Check if PR number exists in wiki/Changelog diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml new file mode 100644 index 00000000000..d299de8301c --- /dev/null +++ b/.github/workflows/check-formatting.yml @@ -0,0 +1,21 @@ +name: Check formatting +on: workflow_call + +jobs: + pre-commit: + name: Run pre-commit hooks + runs-on: ubuntu-22.04 + steps: + - name: Checkout the latest code (shallow clone) + uses: actions/checkout@v4 + - name: Run Pre-Commit checks + run: cp .github/check-format.sh /tmp && /tmp/check-format.sh + id: pre-commit + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload code formatting patch + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: patch + path: format.patch diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index db18b510e21..5cd9b516b64 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: configure run: | diff --git a/.github/workflows/joss.yml b/.github/workflows/joss.yml index d4557a44b43..331e02b2467 100644 --- a/.github/workflows/joss.yml +++ b/.github/workflows/joss.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: setup run: sudo apt-get install texlive-xetex pandoc pandoc-citeproc diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 8d365decc53..0bc5b221938 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop fetch-depth: 0 diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 2db1558f434..c805f8979e2 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: setup run: | diff --git a/.github/workflows/spell_check.yml b/.github/workflows/spell_check.yml index 0049dce9180..7369d3b42e3 100644 --- a/.github/workflows/spell_check.yml +++ b/.github/workflows/spell_check.yml @@ -8,7 +8,7 @@ jobs: name: Spell Check with Typos runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check for typos uses: crate-ci/typos@master with: diff --git a/.github/workflows/windows-mingw.yml b/.github/workflows/windows-mingw.yml index fc1906c982d..9f16f8cc9e6 100644 --- a/.github/workflows/windows-mingw.yml +++ b/.github/workflows/windows-mingw.yml @@ -32,7 +32,7 @@ jobs: runs-on: [windows-latest] steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Debug over SSH (tmate) uses: mxschmitt/action-tmate@v3.5 diff --git a/.github/workflows/windows-msvc-cuda.yml b/.github/workflows/windows-msvc-cuda.yml index d58910c5dbc..1bf6a7bee85 100644 --- a/.github/workflows/windows-msvc-cuda.yml +++ b/.github/workflows/windows-msvc-cuda.yml @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: setup (versioned) if: matrix.config.version != 'latest' run: | diff --git a/.github/workflows/windows-msvc-ref.yml b/.github/workflows/windows-msvc-ref.yml index 87f9214876d..117262b2016 100644 --- a/.github/workflows/windows-msvc-ref.yml +++ b/.github/workflows/windows-msvc-ref.yml @@ -37,7 +37,7 @@ jobs: runs-on: [windows-latest] steps: - name: Checkout the latest code (shallow clone) - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Debug over SSH (tmate) uses: mxschmitt/action-tmate@v3.5 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..224e8e8e468 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: 'v14.0.0' # The default in Ubuntu 22.04, which is used in our CI + hooks: + - id: clang-format + types_or: [c, c++, cuda, inc] + exclude: third_party/SuiteSparse/AMD/.* diff --git a/ABOUT-LICENSING.md b/ABOUT-LICENSING.md index d6e68911d1a..b2fbb31f961 100644 --- a/ABOUT-LICENSING.md +++ b/ABOUT-LICENSING.md @@ -48,32 +48,6 @@ following license: > (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -When compiling Ginkgo with `-DGINKGO_DEVEL_TOOLS=ON` the build system will download -[git-cmake-format](https://github.com/kbenzie/git-cmake-format), available under -the following license: - -> This is free and unencumbered software released into the public domain. -> -> Anyone is free to copy, modify, publish, use, compile, sell, or distribute -> this software, either in source code form or as a compiled binary, for any -> purpose, commercial or non-commercial, and by any means. -> -> In jurisdictions that recognize copyright laws, the author or authors of this -> software dedicate any and all copyright interest in the software to the public -> domain. We make this dedication for the benefit of the public at large and to -> the detriment of our heirs and successors. We intend this dedication to be an -> overt act of relinquishment in perpetuity of all present and future rights to -> this software under copyright law. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTBILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT, IN NO EVENT SHALL THE -> AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN -> ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -> -> For more information, please refer to - When compiling Ginkgo with `-DGINKGO_BUILD_BENCHMARKS=ON` the build system will download, build, and link [gflags](https://github.com/gflags/gflags) and [nlohmann-json](https://github.com/nlohmann/json) with the @@ -193,44 +167,38 @@ under the following license: For detecting the HWLOC library, we used a modified version of the FindHWLOC.cmake file from the MORSE-cmake library. The library is [available on gitlab](https://gitlab.inria.fr/solverstack/morse_cmake), and its LICENSE is available below: -> ### -> # -> # @copyright (c) 2012-2020 Inria. All rights reserved. -> # @copyright (c) 2012-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -> # -> ### -> # -> # This software is a computer program whose purpose is to process -> # Matrices Over Runtime Systems @ Exascale (MORSE). More information -> # can be found on the following website: http://www.inria.fr/en/teams/morse. -> # -> # This software is governed by the CeCILL-C license under French law and -> # abiding by the rules of distribution of free software. You can use, -> # modify and/ or redistribute the software under the terms of the CeCILL-C -> # license as circulated by CEA, CNRS and INRIA at the following URL -> # "http://www.cecill.info". -> # -> # As a counterpart to the access to the source code and rights to copy, -> # modify and redistribute granted by the license, users are provided only -> # with a limited warranty and the software's author, the holder of the -> # economic rights, and the successive licensors have only limited -> # liability. -> # -> # In this respect, the user's attention is drawn to the risks associated -> # with loading, using, modifying and/or developing or reproducing the -> # software by the user in light of its specific status of free software, -> # that may mean that it is complicated to manipulate, and that also -> # therefore means that it is reserved for developers and experienced -> # professionals having in-depth computer knowledge. Users are therefore -> # encouraged to load and test the software's suitability as regards their -> # requirements in conditions enabling the security of their systems and/or -> # data to be ensured and, more generally, to use and operate it in the -> # same conditions as regards security. -> # -> # The fact that you are presently reading this means that you have had -> # knowledge of the CeCILL-C license and that you accept its terms. -> # -> ### +> @copyright (c) 2012-2020 Inria. All rights reserved. +> @copyright (c) 2012-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. +> +> This software is a computer program whose purpose is to process +> Matrices Over Runtime Systems @ Exascale (MORSE). More information +> can be found on the following website: http://www.inria.fr/en/teams/morse. +> +> This software is governed by the CeCILL-C license under French law and +> abiding by the rules of distribution of free software. You can use, +> modify and/ or redistribute the software under the terms of the CeCILL-C +> license as circulated by CEA, CNRS and INRIA at the following URL +> "http://www.cecill.info". +> +> As a counterpart to the access to the source code and rights to copy, +> modify and redistribute granted by the license, users are provided only +> with a limited warranty and the software's author, the holder of the +> economic rights, and the successive licensors have only limited +> liability. +> +> In this respect, the user's attention is drawn to the risks associated +> with loading, using, modifying and/or developing or reproducing the +> software by the user in light of its specific status of free software, +> that may mean that it is complicated to manipulate, and that also +> therefore means that it is reserved for developers and experienced +> professionals having in-depth computer knowledge. Users are therefore +> encouraged to load and test the software's suitability as regards their +> requirements in conditions enabling the security of their systems and/or +> data to be ensured and, more generally, to use and operate it in the +> same conditions as regards security. +> +> The fact that you are presently reading this means that you have had +> knowledge of the CeCILL-C license and that you accept its terms. @@ -243,30 +211,30 @@ INSTALL.md](INSTALL.md#Building) for more details. When using testing with MPI switched on, the gtest-mpi-listener header only library is used for testing MPI functionality. The repository is licensed triple licensed under BSD-3, MIT and Apache 2.0. The License duplicated below. More details on the License and the library are [available on github](https://github.com/LLNL/gtest-mpi-listener) -> # Copyright 2005, Google Inc. All rights reserved. -> # -> # Redistribution and use in source and binary forms, with or without -> # modification, are permitted provided that the following conditions are -> # met: -> # -> # * Redistributions of source code must retain the above copyright -> # notice, this list of conditions and the following disclaimer. -> # * Redistributions in binary form must reproduce the above -> # copyright notice, this list of conditions and the following disclaimer -> # in the documentation and/or other materials provided with the -> # distribution. -> # * Neither the name of Google Inc. nor the names of its -> # contributors may be used to endorse or promote products derived from -> # this software without specific prior written permission. -> # -> # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -> # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -> # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -> # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -> # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -> # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -> # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -> # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -> # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +> Copyright 2005, Google Inc. All rights reserved. +> +> Redistribution and use in source and binary forms, with or without +> modification, are permitted provided that the following conditions are +> met: +> +> * Redistributions of source code must retain the above copyright +> notice, this list of conditions and the following disclaimer. +> * Redistributions in binary form must reproduce the above +> copyright notice, this list of conditions and the following disclaimer +> in the documentation and/or other materials provided with the +> distribution. +> * Neither the name of Google Inc. nor the names of its +> contributors may be used to endorse or promote products derived from +> this software without specific prior written permission. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +> A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +> OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +> THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/CMakeLists.txt b/CMakeLists.txt index c080a290109..53145efb536 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,13 +354,34 @@ if(GINKGO_BUILD_BENCHMARKS) endif() if(GINKGO_DEVEL_TOOLS) - add_custom_target(add_license - COMMAND ${Ginkgo_SOURCE_DIR}/dev_tools/scripts/add_license.sh - WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR}) - # if git-cmake-format can not build format target, do not add the dependencies - if(TARGET format) - add_dependencies(format add_license) + find_program(PRE_COMMIT pre-commit) + if(NOT PRE_COMMIT) + message(FATAL_ERROR "The pre-commit command was not found. It is necessary if you want to commit changes to Ginkgo. " + "If that is not the case, set GINKGO_DEVEL_TOOLS=OFF. " + "Otherwise install pre-commit via pipx (or pip) using:\n" + " pipx install pre-commit") + endif() + + execute_process(COMMAND "${PRE_COMMIT}" "install" + WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR} + RESULT_VARIABLE pre-commit-result + OUTPUT_VARIABLE pre-commit-output + ERROR_VARIABLE pre-commit-error) + if(pre-commit-result) + message(FATAL_ERROR + "Failed to install the git hooks via pre-commit. Please check the error message:\n" + "${pre-commit-output}\n${pre-commit-error}") endif() + + add_custom_target(format + COMMAND bash -c "${PRE_COMMIT} run" + WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR} + VERBATIM) + + add_custom_target(add_license + COMMAND ${Ginkgo_SOURCE_DIR}/dev_tools/scripts/add_license.sh + WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR}) + add_dependencies(format add_license) endif() # MacOS needs to install bash, gnu-sed, findutils and coreutils diff --git a/INSTALL.md b/INSTALL.md index 4da58010ba8..014e1978f23 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -16,7 +16,7 @@ Replace `[OPTIONS]` with desired cmake options for your build. Ginkgo adds the following additional switches to control what is being built: * `-DGINKGO_DEVEL_TOOLS={ON, OFF}` sets up the build system for development - (requires clang-format, will also download git-cmake-format), + (requires pre-commit, will also download the clang-format pre-commit hook), default is `OFF`. The default behavior installs a pre-commit hook, which disables git commits. If it is set to `ON`, a new pre-commit hook for formatting will be installed (enabling commits again). In both cases the @@ -207,9 +207,6 @@ packages can be turned off by disabling the relevant options. + GINKGO_BUILD_BENCHMARKS=ON: For argument management we use [gflags](https://github.com/gflags/gflags) and for JSON parsing we use [nlohmann-json](https://github.com/nlohmann/json); -+ GINKGO_DEVEL_TOOLS=ON: - [git-cmake-format](https://github.com/gflegar/git-cmake-format) is our CMake - helper for code formatting. + GINKGO_BUILD_HWLOC=ON: [hwloc](https://www.open-mpi.org/projects/hwloc) to detect and control cores and devices. diff --git a/core/test/base/deferred_factory.cpp b/core/test/base/deferred_factory.cpp index 27b20b35da2..535438c1729 100644 --- a/core/test/base/deferred_factory.cpp +++ b/core/test/base/deferred_factory.cpp @@ -86,8 +86,8 @@ struct test_impl()...))>, T, // specialization for DF2 with_factory_list template -struct test_impl()...))>, +struct test_impl()...))>, DummyFlag, Args...> : std::true_type {}; // test the object can be constructable or not with Args. diff --git a/dpcpp/factorization/par_ilut_filter_kernels.hpp.inc b/dpcpp/factorization/par_ilut_filter_kernels.hpp.inc index 2b956917149..cea288ca7cb 100644 --- a/dpcpp/factorization/par_ilut_filter_kernels.hpp.inc +++ b/dpcpp/factorization/par_ilut_filter_kernels.hpp.inc @@ -115,12 +115,13 @@ void threshold_filter_nnz(dim3 grid, dim3 block, remove_complex threshold, IndexType* nnz, bool lower) { - queue->parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(subgroup_size)]] { - threshold_filter_nnz( - row_ptrs, vals, num_rows, threshold, nnz, lower, item_ct1); - }); + queue->parallel_for(sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(subgroup_size)]] { + threshold_filter_nnz( + row_ptrs, vals, num_rows, threshold, nnz, + lower, item_ct1); + }); } @@ -152,14 +153,15 @@ void threshold_filter(dim3 grid, dim3 block, size_type dynamic_shared_memory, const IndexType* new_row_ptrs, IndexType* new_row_idxs, IndexType* new_col_idxs, ValueType* new_vals, bool lower) { - queue->parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(subgroup_size)]] { - threshold_filter( - old_row_ptrs, old_col_idxs, old_vals, num_rows, threshold, - new_row_ptrs, new_row_idxs, new_col_idxs, new_vals, lower, - item_ct1); - }); + queue->parallel_for(sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(subgroup_size)]] { + threshold_filter( + old_row_ptrs, old_col_idxs, old_vals, + num_rows, threshold, new_row_ptrs, + new_row_idxs, new_col_idxs, new_vals, lower, + item_ct1); + }); } @@ -183,12 +185,13 @@ void bucket_filter_nnz(dim3 grid, dim3 block, size_type dynamic_shared_memory, const BucketType* buckets, IndexType num_rows, BucketType bucket, IndexType* nnz) { - queue->parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(subgroup_size)]] { - bucket_filter_nnz(row_ptrs, buckets, num_rows, - bucket, nnz, item_ct1); - }); + queue->parallel_for(sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(subgroup_size)]] { + bucket_filter_nnz( + row_ptrs, buckets, num_rows, bucket, nnz, + item_ct1); + }); } @@ -222,13 +225,15 @@ void bucket_filter(dim3 grid, dim3 block, size_type dynamic_shared_memory, IndexType* new_row_idxs, IndexType* new_col_idxs, ValueType* new_vals) { - queue->parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(subgroup_size)]] { - bucket_filter( - old_row_ptrs, old_col_idxs, old_vals, buckets, num_rows, bucket, - new_row_ptrs, new_row_idxs, new_col_idxs, new_vals, item_ct1); - }); + queue->parallel_for(sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(subgroup_size)]] { + bucket_filter( + old_row_ptrs, old_col_idxs, old_vals, + buckets, num_rows, bucket, new_row_ptrs, + new_row_idxs, new_col_idxs, new_vals, + item_ct1); + }); } diff --git a/dpcpp/factorization/par_ilut_select_kernels.hpp.inc b/dpcpp/factorization/par_ilut_select_kernels.hpp.inc index 8ea48545c27..7356b0d9921 100644 --- a/dpcpp/factorization/par_ilut_select_kernels.hpp.inc +++ b/dpcpp/factorization/par_ilut_select_kernels.hpp.inc @@ -68,13 +68,13 @@ void build_searchtree(dim3 grid, dim3 block, size_type dynamic_shared_memory, sycl::access::target::local> sh_samples_acc_ct1(sycl::range<1>(1024 /*sample_size*/), cgh); - cgh.parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size( - config::warp_size)]] { - build_searchtree(input, size, tree_output, item_ct1, - sh_samples_acc_ct1.get_pointer()); - }); + cgh.parallel_for(sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(config::warp_size)]] { + build_searchtree( + input, size, tree_output, item_ct1, + sh_samples_acc_ct1.get_pointer()); + }); }); } @@ -256,12 +256,13 @@ void block_prefix_sum(dim3 grid, dim3 block, size_type dynamic_shared_memory, cgh); cgh.parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size( - config::warp_size)]] { - block_prefix_sum(counters, totals, num_blocks, item_ct1, - (IndexType*)warp_sums_acc_ct1.get_pointer()); - }); + sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(config::warp_size)]] { + block_prefix_sum( + counters, totals, num_blocks, item_ct1, + (IndexType*)warp_sums_acc_ct1.get_pointer()); + }); }); } @@ -363,12 +364,12 @@ void basecase_select(dim3 grid, dim3 block, size_type dynamic_shared_memory, sh_local_acc_ct1(sycl::range<1>(1024 /*basecase_size*/), cgh); cgh.parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size( - config::warp_size)]] { - basecase_select(input, size, rank, out, item_ct1, - (ValueType*)sh_local_acc_ct1.get_pointer()); - }); + sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(config::warp_size)]] { + basecase_select(input, size, rank, out, item_ct1, + (ValueType*)sh_local_acc_ct1.get_pointer()); + }); }); } @@ -403,12 +404,11 @@ template void find_bucket(dim3 grid, dim3 block, size_type dynamic_shared_memory, sycl::queue* queue, IndexType* prefix_sum, IndexType rank) { - queue->parallel_for( - sycl_nd_range(grid, block), [= - ](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size( - config::warp_size)]] { - find_bucket(prefix_sum, rank, item_ct1); - }); + queue->parallel_for(sycl_nd_range(grid, block), + [=](sycl::nd_item<3> item_ct1) + [[sycl::reqd_sub_group_size(config::warp_size)]] { + find_bucket(prefix_sum, rank, item_ct1); + }); } diff --git a/dpcpp/solver/common_gmres_kernels.dp.inc b/dpcpp/solver/common_gmres_kernels.dp.inc index 8a03c755ae6..73cdb43d718 100644 --- a/dpcpp/solver/common_gmres_kernels.dp.inc +++ b/dpcpp/solver/common_gmres_kernels.dp.inc @@ -6,13 +6,14 @@ // Must be called with at least `max(stride_b * num_rows, krylov_dim * // num_cols)` threads in total. template -void initialize_kernel( - size_type num_rows, size_type num_cols, size_type krylov_dim, - const ValueType *__restrict__ b, size_type stride_b, - ValueType *__restrict__ residual, size_type stride_residual, - ValueType *__restrict__ givens_sin, size_type stride_sin, - ValueType *__restrict__ givens_cos, size_type stride_cos, - stopping_status *__restrict__ stop_status, sycl::nd_item<3> item_ct1) +void initialize_kernel(size_type num_rows, size_type num_cols, + size_type krylov_dim, const ValueType* __restrict__ b, + size_type stride_b, ValueType* __restrict__ residual, + size_type stride_residual, + ValueType* __restrict__ givens_sin, size_type stride_sin, + ValueType* __restrict__ givens_cos, size_type stride_cos, + stopping_status* __restrict__ stop_status, + sycl::nd_item<3> item_ct1) { const auto global_id = thread::get_thread_id_flat(item_ct1); @@ -39,15 +40,15 @@ void initialize_kernel( template void initialize_kernel(dim3 grid, dim3 block, size_type dynamic_shared_memory, - sycl::queue *queue, size_type num_rows, - size_type num_cols, size_type krylov_dim, - const ValueType *b, size_type stride_b, - ValueType *residual, size_type stride_residual, - ValueType *givens_sin, size_type stride_sin, - ValueType *givens_cos, size_type stride_cos, - stopping_status *stop_status) + sycl::queue* queue, size_type num_rows, + size_type num_cols, size_type krylov_dim, + const ValueType* b, size_type stride_b, + ValueType* residual, size_type stride_residual, + ValueType* givens_sin, size_type stride_sin, + ValueType* givens_cos, size_type stride_cos, + stopping_status* stop_status) { - queue->submit([&](sycl::handler &cgh) { + queue->submit([&](sycl::handler& cgh) { cgh.parallel_for( sycl_nd_range(grid, block), [=](sycl::nd_item<3> item_ct1) { initialize_kernel( @@ -61,12 +62,12 @@ void initialize_kernel(dim3 grid, dim3 block, size_type dynamic_shared_memory, template void calculate_sin_and_cos_kernel(size_type col_idx, size_type num_cols, - size_type iter, const ValueType &this_hess, - const ValueType &next_hess, - ValueType *givens_sin, size_type stride_sin, - ValueType *givens_cos, size_type stride_cos, - ValueType ®ister_sin, - ValueType ®ister_cos) + size_type iter, const ValueType& this_hess, + const ValueType& next_hess, + ValueType* givens_sin, size_type stride_sin, + ValueType* givens_cos, size_type stride_cos, + ValueType& register_sin, + ValueType& register_cos) { if (is_zero(this_hess)) { register_cos = zero(); @@ -89,10 +90,10 @@ void calculate_sin_and_cos_kernel(size_type col_idx, size_type num_cols, template void calculate_residual_norm_kernel(size_type col_idx, size_type num_cols, size_type iter, - const ValueType ®ister_sin, - const ValueType ®ister_cos, - remove_complex *residual_norm, - ValueType *residual_norm_collection, + const ValueType& register_sin, + const ValueType& register_cos, + remove_complex* residual_norm, + ValueType* residual_norm_collection, size_type stride_residual_norm_collection) { const auto this_rnc = @@ -112,13 +113,13 @@ void calculate_residual_norm_kernel(size_type col_idx, size_type num_cols, template void givens_rotation_kernel( size_type num_rows, size_type num_cols, size_type iter, - ValueType *__restrict__ hessenberg_iter, size_type stride_hessenberg, - ValueType *__restrict__ givens_sin, size_type stride_sin, - ValueType *__restrict__ givens_cos, size_type stride_cos, - remove_complex *__restrict__ residual_norm, - ValueType *__restrict__ residual_norm_collection, + ValueType* __restrict__ hessenberg_iter, size_type stride_hessenberg, + ValueType* __restrict__ givens_sin, size_type stride_sin, + ValueType* __restrict__ givens_cos, size_type stride_cos, + remove_complex* __restrict__ residual_norm, + ValueType* __restrict__ residual_norm_collection, size_type stride_residual_norm_collection, - const stopping_status *__restrict__ stop_status, sycl::nd_item<3> item_ct1) + const stopping_status* __restrict__ stop_status, sycl::nd_item<3> item_ct1) { const auto col_idx = thread::get_thread_id_flat(item_ct1); @@ -167,18 +168,18 @@ void givens_rotation_kernel( template void givens_rotation_kernel(dim3 grid, dim3 block, - size_type dynamic_shared_memory, sycl::queue *queue, + size_type dynamic_shared_memory, sycl::queue* queue, size_type num_rows, size_type num_cols, - size_type iter, ValueType *hessenberg_iter, - size_type stride_hessenberg, ValueType *givens_sin, - size_type stride_sin, ValueType *givens_cos, + size_type iter, ValueType* hessenberg_iter, + size_type stride_hessenberg, ValueType* givens_sin, + size_type stride_sin, ValueType* givens_cos, size_type stride_cos, - remove_complex *residual_norm, - ValueType *residual_norm_collection, + remove_complex* residual_norm, + ValueType* residual_norm_collection, size_type stride_residual_norm_collection, - const stopping_status *stop_status) + const stopping_status* stop_status) { - queue->submit([&](sycl::handler &cgh) { + queue->submit([&](sycl::handler& cgh) { cgh.parallel_for( sycl_nd_range(grid, block), [=](sycl::nd_item<3> item_ct1) { givens_rotation_kernel( @@ -195,11 +196,11 @@ void givens_rotation_kernel(dim3 grid, dim3 block, template void solve_upper_triangular_kernel( size_type num_cols, size_type num_rhs, - const ValueType *__restrict__ residual_norm_collection, + const ValueType* __restrict__ residual_norm_collection, size_type stride_residual_norm_collection, - const ValueType *__restrict__ hessenberg, size_type stride_hessenberg, - ValueType *__restrict__ y, size_type stride_y, - const size_type *__restrict__ final_iter_nums, sycl::nd_item<3> item_ct1) + const ValueType* __restrict__ hessenberg, size_type stride_hessenberg, + ValueType* __restrict__ y, size_type stride_y, + const size_type* __restrict__ final_iter_nums, sycl::nd_item<3> item_ct1) { const auto col_idx = thread::get_thread_id_flat(item_ct1); @@ -225,14 +226,14 @@ void solve_upper_triangular_kernel( template void solve_upper_triangular_kernel( - dim3 grid, dim3 block, size_type dynamic_shared_memory, sycl::queue *queue, + dim3 grid, dim3 block, size_type dynamic_shared_memory, sycl::queue* queue, size_type num_cols, size_type num_rhs, - const ValueType *residual_norm_collection, - size_type stride_residual_norm_collection, const ValueType *hessenberg, - size_type stride_hessenberg, ValueType *y, size_type stride_y, - const size_type *final_iter_nums) + const ValueType* residual_norm_collection, + size_type stride_residual_norm_collection, const ValueType* hessenberg, + size_type stride_hessenberg, ValueType* y, size_type stride_y, + const size_type* final_iter_nums) { - queue->submit([&](sycl::handler &cgh) { + queue->submit([&](sycl::handler& cgh) { cgh.parallel_for( sycl_nd_range(grid, block), [=](sycl::nd_item<3> item_ct1) { solve_upper_triangular_kernel( diff --git a/examples/kokkos_assembly/kokkos_assembly.cpp b/examples/kokkos_assembly/kokkos_assembly.cpp index 42774afcfe5..75aea97555e 100644 --- a/examples/kokkos_assembly/kokkos_assembly.cpp +++ b/examples/kokkos_assembly/kokkos_assembly.cpp @@ -8,8 +8,8 @@ #include -#include #include +#include // Creates a stencil matrix in CSR format for the given number of discretization diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 828f95bc8ca..749d24b87bd 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -3,10 +3,7 @@ if(GINKGO_BUILD_TESTS AND (NOT GTest_FOUND)) add_subdirectory(gtest) endif() -if(GINKGO_DEVEL_TOOLS) - set(GCF_IGNORE_LIST "third_party" CACHE STRING "Ignore directories for GCF") - add_subdirectory(git-cmake-format) -else() +if(NOT GINKGO_DEVEL_TOOLS) add_subdirectory(dummy-hook) endif() diff --git a/third_party/dummy-hook/CMakeLists.txt b/third_party/dummy-hook/CMakeLists.txt index 39cd00bfb15..0e4245f87a8 100644 --- a/third_party/dummy-hook/CMakeLists.txt +++ b/third_party/dummy-hook/CMakeLists.txt @@ -14,18 +14,9 @@ if(GIT_FOUND) set(ADD_HOOK FALSE) set(HOOK_LOCATION "${Ginkgo_GIT_HOOKS_DIR}/pre-commit") if(NOT EXISTS "${HOOK_LOCATION}") - set(ADD_HOOK TRUE) - else() - # check if the correct hook is installed - execute_process(COMMAND grep git-cmake-format.py "${HOOK_LOCATION}" - RESULT_VARIABLE res OUTPUT_QUIET) - # return value =/= 0 means the pattern was not found - if(NOT res EQUAL 0) - set(ADD_HOOK TRUE) - endif() - endif() - if(ADD_HOOK) configure_file(dummy_hook "${HOOK_LOCATION}" COPYONLY) + else() + message(STATUS "A pre-commit hook already exists, not installing dummy hook.") endif() endif() endif() diff --git a/third_party/git-cmake-format/CMakeLists.txt b/third_party/git-cmake-format/CMakeLists.txt deleted file mode 100644 index 7766411d481..00000000000 --- a/third_party/git-cmake-format/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -message(STATUS "Fetching git-cmake-format") -include(FetchContent) -FetchContent_Declare( - git_cmake_format - GIT_REPOSITORY https://github.com/ginkgo-project/git-cmake-format.git - GIT_TAG 26465c1669f3f64bf6709170fb98dcf63561b29e -) -FetchContent_GetProperties(git_cmake_format) -if(NOT git_cmake_format_POPULATED) - FetchContent_Populate(git_cmake_format) - - set(GCF_FORCE_OVERWRITE ON CACHE INTERNAL "If true, always overwrite pre-commit hook and script") - set(GCF_GIT_TOP_LEVEL_DIR ${Ginkgo_SOURCE_DIR}) - add_subdirectory(${git_cmake_format_SOURCE_DIR} ${git_cmake_format_BINARY_DIR} EXCLUDE_FROM_ALL) -endif()