Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace capture-by-value with capture-by-ref to resolve -Werror #1502

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

ndellingwood
Copy link
Contributor

error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20

error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20
@ndellingwood
Copy link
Contributor Author

Resolve nightly build -Werror fails with gcc/9.2.0 and c++20 support

01:03:33 In file included from /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/unit_test/graph/Test_Graph_coarsen.hpp:51,
01:03:33                  from /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/unit_test/graph/Test_Graph.hpp:8,
01:03:33                  from /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/unit_test/serial/Test_Serial_Graph.cpp:5:
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp: In lambda function:
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:601:11: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
01:03:33   601 |           [=](const edge_offset_t u_idx) {
01:03:33       |           ^
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:601:11: note: add explicit ‘this’ or ‘*this’ capture
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp: In lambda function:
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:772:11: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
01:03:33   772 |           [=](volatile ordinal_t*& ptr_write) {
01:03:33       |           ^
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:772:11: note: add explicit ‘this’ or ‘*this’ capture
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp: In lambda function:
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:1279:28: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
01:03:33  1279 |                            [=](const edge_offset_t idx) {
01:03:33       |                            ^
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:1279:28: note: add explicit ‘this’ or ‘*this’ capture
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp: In lambda function:
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:1735:11: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
01:03:33  1735 |           [=](const edge_offset_t idx, ordinal_t& local_sum) {
01:03:33       |           ^
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:1735:11: note: add explicit ‘this’ or ‘*this’ capture
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp: In lambda function:
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:1743:44: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
01:03:33  1743 |       Kokkos::single(Kokkos::PerThread(t), [=]() {
01:03:33       |                                            ^
01:03:33 /home/jenkins/jenkins-new/workspace/KokkosKernels_KokkosDev_GCC920_cpp20/kokkos-kernels/src/graph/KokkosGraph_CoarsenConstruct.hpp:1743:44: note: add explicit ‘this’ or ‘*this’ capture

Reproducer (kokkos-dev):

source /projects/sems/modulefiles/utils/sems-archive-modules-init.sh
module purge
module load sems-archive-env sems-archive-cmake/3.17.1 sems-archive-gcc/9.2.0
$KOKKOSKERNELS_PATH/cm_generate_makefile.bash --with-devices=Serial --compiler=g++ --cxxflags="-O3 -Wall -Wunused-parameter -Wshadow -pedantic -Werror -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wclobbered -Wuninitialized " --cxxstandard="20" --ldflags=""   --kokkos-path=$KOKKOS_PATH --kokkoskernels-path=$KOKKOSKERNELS_PATH --with-scalars='double,complex_double' --with-ordinals=int --with-offsets=int,size_t --with-layouts=LayoutLeft --with-options=disable_deprecated_code --no-examples

This occurred following merge of these commits to Kokkos:
Changes from Git (git https://github.com/kokkos/kokkos.git)
Summary

Prefer std::void_t now that C++17 is available ([commit: 746a110](https://github.com/kokkos/kokkos/commit/746a1100153b888a3fc24d181bd879db40b3ff9d)) ([details](https://jenkins-son.sandia.gov/job/KokkosKernels_KokkosDev_GCC920_cpp20/663/changes#746a1100153b888a3fc24d181bd879db40b3ff9d))
Fixup include <Kokkos_Macros.hpp> to pass header self-containment test ([commit: d85fb44](https://github.com/kokkos/kokkos/commit/d85fb448aaf026b12b087ed0ddd480f218508aa9)) ([details](https://jenkins-son.sandia.gov/job/KokkosKernels_KokkosDev_GCC920_cpp20/663/changes#d85fb448aaf026b12b087ed0ddd480f218508aa9))
Rename Impl::{identity -> type_identity} and import it from std:: when C++20 is available ([commit: 889a530](https://github.com/kokkos/kokkos/commit/889a530e453071505e8c29e3f248697354bd0979)) ([details](https://jenkins-son.sandia.gov/job/KokkosKernels_KokkosDev_GCC920_cpp20/663/changes#889a530e453071505e8c29e3f248697354bd0979))
Clean up CUDA <= 10.0 checks ([commit: 7d9b708](https://github.com/kokkos/kokkos/commit/7d9b708cf9e8c8ffd01cb1368a7d82220412fda9)) ([details](https://jenkins-son.sandia.gov/job/KokkosKernels_KokkosDev_GCC920_cpp20/663/changes#7d9b708cf9e8c8ffd01cb1368a7d82220412fda9))
Tracking performance testing: Integrate google benchmark (#5177) ([commit: 2d6cbad](https://github.com/kokkos/kokkos/commit/2d6cbad7e079eb45ae69ac6a59929d9fcf10409a)) ([details](https://jenkins-son.sandia.gov/job/KokkosKernels_KokkosDev_GCC920_cpp20/663/changes#2d6cbad7e079eb45ae69ac6a59929d9fcf10409a))

@kokkos-devops-admin
Copy link

Status Flag 'Pre-Test Inspection' - Auto Inspected - Inspection Is Not Necessary for this Pull Request.

@kokkos-devops-admin
Copy link

Status Flag 'Pull Request AutoTester' - Testing Jenkins Projects:

Pull Request Auto Testing STARTING (click to expand)

Build Information

Test Name: KokkosKernels_PullRequest_GCC720_Light_Tpls_GCC720_GCC740

  • Build Num: 51
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_CUDA10_Tpls_CUDA10_LayoutRight

  • Build Num: 381
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720

  • Build Num: 48
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720_Light_LayoutRight

  • Build Num: 46
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_GCC720

  • Build Num: 46
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_INTEL18

  • Build Num: 1167
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_CLANG1001

  • Build Num: 46
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Using Repos:

Repo: KOKKOSKERNELS (ndellingwood/kokkos-kernels)
  • Branch: fix-cpp20-werror
  • SHA: 785ec49
  • Mode: TEST_REPO

Pull Request Author: ndellingwood

@kokkos-devops-admin
Copy link

Status Flag 'Pull Request AutoTester' - Jenkins Testing: all Jobs PASSED

Pull Request Auto Testing has PASSED (click to expand)

Build Information

Test Name: KokkosKernels_PullRequest_GCC720_Light_Tpls_GCC720_GCC740

  • Build Num: 51
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_CUDA10_Tpls_CUDA10_LayoutRight

  • Build Num: 381
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720

  • Build Num: 48
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720_Light_LayoutRight

  • Build Num: 46
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_GCC720

  • Build Num: 46
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_INTEL18

  • Build Num: 1167
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_CLANG1001

  • Build Num: 46
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH fix-cpp20-werror
KOKKOSKERNELS_SOURCE_REPO https://github.com/ndellingwood/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 785ec49
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 5930a2b
PR_LABELS
PULLREQUESTNUM 1502
TEST_REPO_ALIAS KOKKOSKERNELS

@kokkos-devops-admin
Copy link

Status Flag 'Pre-Merge Inspection' - SUCCESS: The last commit to this Pull Request has been INSPECTED AND APPROVED by [ brian-kelley ]!

@kokkos-devops-admin
Copy link

Status Flag 'Pull Request AutoTester' - Pull Request MUST BE MERGED MANUALLY BY Project Team - This Repo does not support Automerge

@ndellingwood ndellingwood merged commit 4f3e7d7 into kokkos:develop Aug 23, 2022
@ndellingwood ndellingwood deleted the fix-cpp20-werror branch August 23, 2022 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants