diff --git a/packages/phalanx/example/FiniteElementAssembly/Mesh.cpp b/packages/phalanx/example/FiniteElementAssembly/Mesh.cpp index b18837921c17..0c8ad139218d 100644 --- a/packages/phalanx/example/FiniteElementAssembly/Mesh.cpp +++ b/packages/phalanx/example/FiniteElementAssembly/Mesh.cpp @@ -204,7 +204,7 @@ KOKKOS_INLINE_FUNCTION void Mesh::operator() (const ComputeJac_Tag& , const team_t& team) const { const int cell = team.league_rank(); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,qp_.extent(0)), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,qp_.extent(0)), [&] (const int& qp) { for (int basis=0; basis < static_cast(basis_.extent(1)); ++basis) { for (int i=0; i < 3; ++i) { for (int j=0; j < 3; ++j) { @@ -220,7 +220,7 @@ KOKKOS_INLINE_FUNCTION void Mesh::operator() (const ComputeInvJac_Tag& , const team_t& team) const { const int cell = team.league_rank(); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,qp_.extent(0)), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,qp_.extent(0)), [&] (const int& qp) { inv_jac_(cell,qp,0,0) = jac_(cell,qp,1,1) * jac_(cell,qp,2,2) - jac_(cell,qp,1,2) * jac_(cell,qp,2,1); inv_jac_(cell,qp,1,1) = jac_(cell,qp,2,2) * jac_(cell,qp,0,0) - jac_(cell,qp,2,0) * jac_(cell,qp,0,2); inv_jac_(cell,qp,2,2) = jac_(cell,qp,0,0) * jac_(cell,qp,1,1) - jac_(cell,qp,0,1) * jac_(cell,qp,1,0); @@ -246,7 +246,7 @@ KOKKOS_INLINE_FUNCTION void Mesh::operator() (const ComputeCoords_Tag& , const team_t& team) const { const int cell = team.league_rank(); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,qp_.extent(0)), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,qp_.extent(0)), [&] (const int& qp) { for (int basis=0; basis < static_cast(basis_.extent(1)); ++basis) { qp_coords_(cell,qp,0) += basis_(qp,basis) * coords_(cell,basis,0); qp_coords_(cell,qp,1) += basis_(qp,basis) * coords_(cell,basis,1); @@ -260,7 +260,7 @@ KOKKOS_INLINE_FUNCTION void Mesh::operator() (const ComputeGradBasisReal_Tag& , const team_t& team) const { const int cell = team.league_rank(); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,grad_basis_real_.extent(1)), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,grad_basis_real_.extent(1)), [&] (const int& qp) { const int num_basis = static_cast(grad_basis_real_.extent(2)); for (int basis=0; basis < num_basis; ++basis) for (int dim1=0; dim1 < 3; ++dim1) diff --git a/packages/phalanx/example/FiniteElementAssembly/WorksetBuilder.hpp b/packages/phalanx/example/FiniteElementAssembly/WorksetBuilder.hpp index aab8d2e09ce0..42e4bb4d28d5 100644 --- a/packages/phalanx/example/FiniteElementAssembly/WorksetBuilder.hpp +++ b/packages/phalanx/example/FiniteElementAssembly/WorksetBuilder.hpp @@ -31,7 +31,7 @@ struct WorksetBuilder { void operator() (const CopyWorksetDetJac_Tag& , const team_t& team) const { const int cell = team.league_rank(); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,mesh_det_jac.extent(1)), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,mesh_det_jac.extent(1)), [&] (const int& qp) { workset_det_jac(cell,qp) = mesh_det_jac(cell+first_cell_global_index,qp); //printf("det_jac=%f\n",workset.det_jac_(cell,qp)); }); @@ -41,7 +41,7 @@ struct WorksetBuilder { void operator() (const CopyWorksetGradBasisReal_Tag& , const team_t& team) const { const int cell = team.league_rank(); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,mesh_det_jac.extent(1)), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,mesh_det_jac.extent(1)), [&] (const int& qp) { for (int basis=0; basis < static_cast(mesh_grad_basis_real.extent(2)); ++basis) for (int dim=0; dim < static_cast(mesh_grad_basis_real.extent(3)); ++dim) workset_grad_basis_real(cell,qp,basis,dim) = diff --git a/packages/phalanx/example/FiniteElementAssembly/evaluators/GatherSolution_Def.hpp b/packages/phalanx/example/FiniteElementAssembly/evaluators/GatherSolution_Def.hpp index 511117b15828..bc4ca937f18a 100644 --- a/packages/phalanx/example/FiniteElementAssembly/evaluators/GatherSolution_Def.hpp +++ b/packages/phalanx/example/FiniteElementAssembly/evaluators/GatherSolution_Def.hpp @@ -50,7 +50,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int cell = team.league_rank(); if (team.team_rank() == 0) { // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [&] (const int& node) { field(cell,node) = x( gids(cell_global_offset_index+cell,node) * num_equations + field_index); }); } @@ -94,8 +94,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const { const int cell = team.league_rank(); if (team.team_rank() == 0) { - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [&] (const int& node) { field(cell,node).val() = x(gids(cell_global_offset_index+cell,node) * num_equations + field_index); field(cell,node).fastAccessDx(num_equations * node + field_index) = 1.0; }); diff --git a/packages/phalanx/example/FiniteElementAssembly/evaluators/ScatterResidual_Def.hpp b/packages/phalanx/example/FiniteElementAssembly/evaluators/ScatterResidual_Def.hpp index 1ddb6ffd7d82..71524568daa1 100644 --- a/packages/phalanx/example/FiniteElementAssembly/evaluators/ScatterResidual_Def.hpp +++ b/packages/phalanx/example/FiniteElementAssembly/evaluators/ScatterResidual_Def.hpp @@ -54,7 +54,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int local_cell = team.league_rank(); if (team.team_rank() == 0) { // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,residual_contribution.extent(1)), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,residual_contribution.extent(1)), [&] (const int& node) { const int residual_index = gids(cell_global_offset_index+local_cell,node) * num_equations + equation_index; global_residual_atomic(residual_index) += residual_contribution(local_cell,node); }); @@ -106,15 +106,13 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int num_nodes = residual_contribution.extent(1); if (team.team_rank() == 0) { - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_nodes), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_nodes), [&] (const int& node) { const int global_row_index = gids(cell_global_offset_index+cell,node) * num_equations + equation_index; global_residual_atomic(global_row_index) += residual_contribution(cell,node).val(); }); } - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_nodes), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_nodes), [&] (const int& node) { const int global_row_index = gids(cell_global_offset_index+cell,node) * num_equations + equation_index; @@ -122,8 +120,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const for (int col_node=0; col_node < num_nodes; ++col_node) { // loop over equations - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_equations),[=] (const int& col_eq) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_equations),[&] (const int& col_eq) { const int global_col_index = gids(cell_global_offset_index+cell,col_node) * num_equations + col_eq; const int derivative_index = col_node * num_equations + col_eq; global_jacobian.sumIntoValues(global_row_index,&global_col_index,1, diff --git a/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/GatherSolution_Def.hpp b/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/GatherSolution_Def.hpp index defeee2c940a..787f3eeaeefe 100644 --- a/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/GatherSolution_Def.hpp +++ b/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/GatherSolution_Def.hpp @@ -50,7 +50,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int cell = team.league_rank(); if (team.team_rank() == 0) { // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [&] (const int& node) { field(cell,node) = x( gids(cell_global_offset_index+cell,node) * num_equations + field_index); }); } @@ -95,7 +95,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int cell = team.league_rank(); if (team.team_rank() == 0) { // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,field.extent(1)), [&] (const int& node) { field(cell,node).val() = x(gids(cell_global_offset_index+cell,node) * num_equations + field_index); field(cell,node).fastAccessDx(num_equations * node + field_index) = 1.0; }); diff --git a/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/ScatterResidual_Def.hpp b/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/ScatterResidual_Def.hpp index 1ddb6ffd7d82..72d729ae454b 100644 --- a/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/ScatterResidual_Def.hpp +++ b/packages/phalanx/example/FiniteElementAssembly_MixedFieldTypes/evaluators/ScatterResidual_Def.hpp @@ -53,8 +53,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const { const int local_cell = team.league_rank(); if (team.team_rank() == 0) { - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,residual_contribution.extent(1)), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,residual_contribution.extent(1)), [&] (const int& node) { const int residual_index = gids(cell_global_offset_index+local_cell,node) * num_equations + equation_index; global_residual_atomic(residual_index) += residual_contribution(local_cell,node); }); @@ -106,15 +105,13 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int num_nodes = residual_contribution.extent(1); if (team.team_rank() == 0) { - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_nodes), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_nodes), [&] (const int& node) { const int global_row_index = gids(cell_global_offset_index+cell,node) * num_equations + equation_index; global_residual_atomic(global_row_index) += residual_contribution(cell,node).val(); }); } - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_nodes), [=] (const int& node) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_nodes), [&] (const int& node) { const int global_row_index = gids(cell_global_offset_index+cell,node) * num_equations + equation_index; @@ -122,8 +119,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const for (int col_node=0; col_node < num_nodes; ++col_node) { // loop over equations - // Fix gcc 5/6 lambda bug by changing to capture by value (potentially less efficient) - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_equations),[=] (const int& col_eq) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_equations),[&] (const int& col_eq) { const int global_col_index = gids(cell_global_offset_index+cell,col_node) * num_equations + col_eq; const int derivative_index = col_node * num_equations + col_eq; global_jacobian.sumIntoValues(global_row_index,&global_col_index,1, diff --git a/packages/phalanx/test/EvaluatorUnitTester/AllRanksEvaluator_Def.hpp b/packages/phalanx/test/EvaluatorUnitTester/AllRanksEvaluator_Def.hpp index b69110b58d97..fd69b0154179 100644 --- a/packages/phalanx/test/EvaluatorUnitTester/AllRanksEvaluator_Def.hpp +++ b/packages/phalanx/test/EvaluatorUnitTester/AllRanksEvaluator_Def.hpp @@ -60,7 +60,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const { const int i = team.league_rank(); - Kokkos::single(Kokkos::PerTeam(team), [=] () { + Kokkos::single(Kokkos::PerTeam(team), [&] () { x1(i) = f1(i) * f1(i); }); diff --git a/packages/phalanx/test/EvaluatorUnitTester/DuplicateFieldEvaluator_Def.hpp b/packages/phalanx/test/EvaluatorUnitTester/DuplicateFieldEvaluator_Def.hpp index 6c17b2eee83f..c6301328f516 100644 --- a/packages/phalanx/test/EvaluatorUnitTester/DuplicateFieldEvaluator_Def.hpp +++ b/packages/phalanx/test/EvaluatorUnitTester/DuplicateFieldEvaluator_Def.hpp @@ -42,7 +42,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int cell = team.league_rank(); const int num_qp = static_cast(a.extent(1)); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_qp), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_qp), [&] (const int& qp) { const int num_dim = static_cast(c.extent(2)); a(cell,qp) = 0.0; for (int i = 0; i < num_dim; ++i) diff --git a/packages/phalanx/test/EvaluatorUnitTester/SimpleEvaluator_Def.hpp b/packages/phalanx/test/EvaluatorUnitTester/SimpleEvaluator_Def.hpp index 50b8eac74e77..847422c9ce6f 100644 --- a/packages/phalanx/test/EvaluatorUnitTester/SimpleEvaluator_Def.hpp +++ b/packages/phalanx/test/EvaluatorUnitTester/SimpleEvaluator_Def.hpp @@ -40,7 +40,7 @@ operator()(const Kokkos::TeamPolicy::member_type& team) const const int cell = team.league_rank(); const int num_qp = static_cast(a.extent(1)); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_qp), [=] (const int& qp) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_qp), [&] (const int& qp) { const int num_dim = static_cast(c.extent(2)); a(cell,qp) = 0.0; for (int i = 0; i < num_dim; ++i) diff --git a/packages/phalanx/test/Kokkos/tKokkosNestedLambda.cpp b/packages/phalanx/test/Kokkos/tKokkosNestedLambda.cpp index 1a5b2b7bd2d2..a744c5d1631c 100644 --- a/packages/phalanx/test/Kokkos/tKokkosNestedLambda.cpp +++ b/packages/phalanx/test/Kokkos/tKokkosNestedLambda.cpp @@ -34,9 +34,9 @@ class MyFunctor { { const int cell = team.league_rank(); const int num_pts = a_.extent(1); - Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_pts), [=] (const int& pt) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,num_pts), [&] (const int& pt) { const int num_eq = a_.extent(2); - Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_eq), [=] (const int& eq) { + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,num_eq), [&] (const int& eq) { c_(cell,pt,eq) = a_(cell,pt,eq) + b_(cell,pt,eq); }); }); diff --git a/packages/phalanx/test/Kokkos/tKokkosPerf.cpp b/packages/phalanx/test/Kokkos/tKokkosPerf.cpp index abf9001649d9..4c5d25cb9dbf 100644 --- a/packages/phalanx/test/Kokkos/tKokkosPerf.cpp +++ b/packages/phalanx/test/Kokkos/tKokkosPerf.cpp @@ -82,7 +82,7 @@ namespace phalanx_test { { const int i = thread.league_rank(); const int num_qp = rho_.extent(1); - Kokkos::parallel_for(Kokkos::TeamThreadRange(thread,0,num_qp), [=] (const int& ip) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(thread,0,num_qp), [&] (const int& ip) { rho_(i,ip) = k_(0) * P_(i,ip) / T_(i,ip); }); }