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

Phalanx: cleanup c++20 warnings and deprecations #13645

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/phalanx/example/FiniteElementAssembly/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(basis_.extent(1)); ++basis) {
for (int i=0; i < 3; ++i) {
for (int j=0; j < 3; ++j) {
Expand All @@ -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);
Expand All @@ -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<int>(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);
Expand All @@ -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<int>(grad_basis_real_.extent(2));
for (int basis=0; basis < num_basis; ++basis)
for (int dim1=0; dim1 < 3; ++dim1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
Expand All @@ -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<int>(mesh_grad_basis_real.extent(2)); ++basis)
for (int dim=0; dim < static_cast<int>(mesh_grad_basis_real.extent(3)); ++dim)
workset_grad_basis_real(cell,qp,basis,dim) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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);
});
}
Expand Down Expand Up @@ -94,8 +94,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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);
});
Expand Down Expand Up @@ -106,24 +106,21 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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;

// loop over nodes
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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);
});
}
Expand Down Expand Up @@ -95,7 +95,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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);
});
Expand Down Expand Up @@ -106,24 +105,21 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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;

// loop over nodes
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::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);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team) const
const int cell = team.league_rank();
const int num_qp = static_cast<int>(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<int>(c.extent(2));
a(cell,qp) = 0.0;
for (int i = 0; i < num_dim; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ operator()(const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team) const
const int cell = team.league_rank();
const int num_qp = static_cast<int>(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<int>(c.extent(2));
a(cell,qp) = 0.0;
for (int i = 0; i < num_dim; ++i)
Expand Down
2 changes: 1 addition & 1 deletion packages/phalanx/test/Kokkos/tKokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ namespace phalanx_test {
n.count_ += 1;
n.mean_ += ( a(i) - n_minus_one.mean_ ) / n.count_;
n.M2_ += ( a(i) - n_minus_one.mean_ ) * ( a(i) - n.mean_ );
success_local = Kokkos::atomic_compare_exchange_strong(&(values()),n_minus_one,n);
success_local = (n_minus_one == Kokkos::atomic_compare_exchange(&(values()),n_minus_one,n));
} while (!success_local);
});
PHX::Device().fence();
Expand Down
4 changes: 2 additions & 2 deletions packages/phalanx/test/Kokkos/tKokkosNestedLambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/phalanx/test/Kokkos/tKokkosPerf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ namespace phalanx_test {

// Derived class
class IdealGasLaw : public EquationOfState {
double mass_; // mass
// double mass_; // mass
double gamma_; // ratio of specific heats
double r_; // Boltzmann constant
// double r_; // Boltzmann constant
public:
KOKKOS_FUNCTION
IdealGasLaw() : mass_(28.0), gamma_(5./3.), r_(1.38066e-23) {}
// IdealGasLaw() : mass_(28.0), gamma_(5./3.), r_(1.38066e-23) {}
IdealGasLaw() : gamma_(5./3.) {}

KOKKOS_FUNCTION
double a(const double& rho,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "Phalanx_DataLayout_MDALayout.hpp"
#include "Phalanx_FieldTag_Tag.hpp"

class CELL;
class BASIS;
struct CELL;
struct BASIS;

namespace PHX {

Expand Down
4 changes: 2 additions & 2 deletions packages/phalanx/test/Utilities/Evaluator_MockDAG_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "Phalanx_FieldTag_Tag.hpp"
#include "Phalanx_MDField.hpp"

class CELL;
class BASIS;
struct CELL;
struct BASIS;

namespace PHX {

Expand Down
Loading