Skip to content

Commit 0ef5974

Browse files
Merge pull request #1771 from arcaneframework/dev/gg-remove-compiler-warnings
Remove some compiler warnings in Alien
2 parents acd3eb4 + 2a78afc commit 0ef5974

File tree

19 files changed

+51
-56
lines changed

19 files changed

+51
-56
lines changed

alien/ArcaneInterface/modules/external_packages/src/alien/kernels/hypre/data_structure/HypreInternal.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ VectorInternal::~VectorInternal()
2929
/*---------------------------------------------------------------------------*/
3030

3131
bool
32-
MatrixInternal::init(const int ilower, const int iupper, const int jlower,
32+
MatrixInternal::init(const HYPRE_Int ilower, const HYPRE_Int iupper, const HYPRE_Int jlower,
3333
const int jupper, const Arccore::ConstArrayView<Arccore::Integer>& lineSizes)
3434
{
3535
int ierr = 0; // code d'erreur de retour

alien/ArcaneInterface/modules/external_packages/src/alien/kernels/petsc/data_structure/PETScInternal.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ VectorInternal::VectorInternal(const int local_size, const int local_offset,
3636
VectorInternal::VectorInternal(const int local_size,
3737
const int local_offset,
3838
const int global_size,
39-
const int block_size,
39+
[[maybe_unused]] const int block_size,
4040
const bool parallel,
4141
MPI_Comm comm)
4242
: m_offset(local_offset)

alien/ArcaneInterface/modules/external_packages/src/alien/kernels/petsc/data_structure/PETScVector.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ PETScVector::~PETScVector()
3636

3737
void
3838
PETScVector::init([[maybe_unused]] const VectorDistribution& dist,
39-
const bool need_allocate, Arccore::Integer block_size ALIEN_UNUSED_PARAM)
39+
const bool need_allocate, [[maybe_unused]] Arccore::Integer block_size)
4040
{
4141
if (need_allocate)
4242
allocate();
@@ -90,7 +90,7 @@ PETScVector::setValues(const int nrow, const int* rows, const double* values)
9090
}
9191

9292
bool
93-
PETScVector::setBlockValues(const int nrow, const int* rows, const int block_size, const double* values)
93+
PETScVector::setBlockValues(const int nrow, const int* rows,[[maybe_unused]] const int block_size, const double* values)
9494
{
9595
if (m_internal->m_internal == nullptr)
9696
return false;
@@ -118,7 +118,7 @@ PETScVector::setValues(const int nrow, const double* values)
118118
}
119119

120120
bool
121-
PETScVector::setBlockValues(const int nrow, const int block_size, const double* values)
121+
PETScVector::setBlockValues(const int nrow,[[maybe_unused]] const int block_size, const double* values)
122122
{
123123
if (!m_internal.get())
124124
return false;
@@ -146,7 +146,7 @@ PETScVector::setValues(Arccore::ConstArrayView<Arccore::Real> values)
146146

147147

148148
bool
149-
PETScVector::setBlockValues(int block_size, Arccore::ConstArrayView<Arccore::Real> values)
149+
PETScVector::setBlockValues([[maybe_unused]] int block_size, Arccore::ConstArrayView<Arccore::Real> values)
150150
{
151151
ALIEN_ASSERT((m_internal.get()), ("Not initialized PETScVector before updating"));
152152
#ifdef PETSC_HAVE_VECSETBLOCKSIZE

alien/ArcaneInterface/modules/interface_c/src/alien/c/alienc.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ extern "C" {
622622

623623
#include "alien/c/alienc.h"
624624

625-
int ALIEN_init(int argc, char** argv)
625+
int ALIEN_init([[maybe_unused]] int argc,[[maybe_unused]] char** argv)
626626
{
627627
AlienManager::initialize() ;
628628
return 0 ;

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/TrilinosBackEnd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ template <> struct AlgebraTraits<BackEnd::tag::tpetraserial>
9393
typedef IInternalLinearSolver<matrix_type, vector_type> solver_type;
9494

9595
static algebra_type* algebra_factory(
96-
Arccore::MessagePassing::IMessagePassingMng* p_mng = nullptr)
96+
[[maybe_unused]] Arccore::MessagePassing::IMessagePassingMng* p_mng = nullptr)
9797
{
9898
return TrilinosInternalLinearAlgebraFactory();
9999
}

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/algebra/TrilinosInternalLinearAlgebra.cc

+12-12
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ TpetraCudaInternalLinearAlgebraFactory(Arccore::MessagePassing::IMessagePassingM
7070
/*---------------------------------------------------------------------------*/
7171

7272
Real
73-
TrilinosInternalLinearAlgebra::norm0(const Vector& x) const
73+
TrilinosInternalLinearAlgebra::norm0([[maybe_unused]] const Vector& x) const
7474
{
7575
return 0.;
7676
}
@@ -92,7 +92,7 @@ TrilinosInternalLinearAlgebra::norm2(const Vector& x) const
9292
}
9393

9494
Real
95-
TrilinosInternalLinearAlgebra::normInf(const Vector& x) const
95+
TrilinosInternalLinearAlgebra::normInf([[maybe_unused]] const Vector& x) const
9696
{
9797
return 0.;
9898
}
@@ -119,7 +119,7 @@ TrilinosInternalLinearAlgebra::axpy(
119119
}
120120

121121
void
122-
TrilinosInternalLinearAlgebra::axpy(Real alpha, const Vector& x, Vector& r) const
122+
TrilinosInternalLinearAlgebra::axpy([[maybe_unused]] Real alpha,[[maybe_unused]] const Vector& x,[[maybe_unused]] Vector& r) const
123123
{
124124
throw NotImplementedException(
125125
A_FUNCINFO, "TrilinosInternalLinearAlgebra::aypx not implemented");
@@ -128,14 +128,14 @@ TrilinosInternalLinearAlgebra::axpy(Real alpha, const Vector& x, Vector& r) cons
128128
/*---------------------------------------------------------------------------*/
129129
void
130130
TrilinosInternalLinearAlgebra::aypx(
131-
Real alpha, UniqueArray<Real>& y, const UniqueArray<Real>& x) const
131+
[[maybe_unused]] Real alpha, [[maybe_unused]] UniqueArray<Real>& y,[[maybe_unused]] const UniqueArray<Real>& x) const
132132
{
133133
throw NotImplementedException(
134134
A_FUNCINFO, "TrilinosInternalLinearAlgebra::aypx not implemented");
135135
}
136136

137137
void
138-
TrilinosInternalLinearAlgebra::aypx(Real alpha, Vector& y, const Vector& x) const
138+
TrilinosInternalLinearAlgebra::aypx([[maybe_unused]] Real alpha,[[maybe_unused]] Vector& y,[[maybe_unused]] const Vector& x) const
139139
{
140140
throw NotImplementedException(
141141
A_FUNCINFO, "TrilinosInternalLinearAlgebra::aypx not implemented");
@@ -145,12 +145,12 @@ TrilinosInternalLinearAlgebra::aypx(Real alpha, Vector& y, const Vector& x) cons
145145

146146
void
147147
TrilinosInternalLinearAlgebra::copy(
148-
const UniqueArray<Real>& x, UniqueArray<Real>& r) const
148+
[[maybe_unused]] const UniqueArray<Real>& x,[[maybe_unused]] UniqueArray<Real>& r) const
149149
{
150150
cblas::copy(x.size(), dataPtr(x), 1, dataPtr(r), 1);
151151
}
152152
void
153-
TrilinosInternalLinearAlgebra::copy(const Vector& x, Vector& r) const
153+
TrilinosInternalLinearAlgebra::copy([[maybe_unused]] const Vector& x,[[maybe_unused]] Vector& r) const
154154
{
155155
throw NotImplementedException(
156156
A_FUNCINFO, "TrilinosInternalLinearAlgebra::aypx not implemented");
@@ -171,14 +171,14 @@ TrilinosInternalLinearAlgebra::dot(const Vector& x, const Vector& y) const
171171

172172
/*---------------------------------------------------------------------------*/
173173
void
174-
TrilinosInternalLinearAlgebra::scal(Real alpha, UniqueArray<Real>& x) const
174+
TrilinosInternalLinearAlgebra::scal([[maybe_unused]] Real alpha,[[maybe_unused]] UniqueArray<Real>& x) const
175175
{
176176
throw NotImplementedException(
177177
A_FUNCINFO, "TrilinosInternalLinearAlgebra::scal not implemented");
178178
}
179179

180180
void
181-
TrilinosInternalLinearAlgebra::scal(Real alpha, Vector& x) const
181+
TrilinosInternalLinearAlgebra::scal([[maybe_unused]] Real alpha,[[maybe_unused]] Vector& x) const
182182
{
183183
throw NotImplementedException(
184184
A_FUNCINFO, "TrilinosInternalLinearAlgebra::scal not implemented");
@@ -187,7 +187,7 @@ TrilinosInternalLinearAlgebra::scal(Real alpha, Vector& x) const
187187
/*---------------------------------------------------------------------------*/
188188

189189
void
190-
TrilinosInternalLinearAlgebra::diagonal(const Matrix& a, Vector& x) const
190+
TrilinosInternalLinearAlgebra::diagonal([[maybe_unused]] const Matrix& a,[[maybe_unused]] Vector& x) const
191191
{
192192
throw NotImplementedException(
193193
A_FUNCINFO, "TrilinosInternalLinearAlgebra::diagonal not implemented");
@@ -196,7 +196,7 @@ TrilinosInternalLinearAlgebra::diagonal(const Matrix& a, Vector& x) const
196196
/*---------------------------------------------------------------------------*/
197197

198198
void
199-
TrilinosInternalLinearAlgebra::reciprocal(Vector& x) const
199+
TrilinosInternalLinearAlgebra::reciprocal([[maybe_unused]] Vector& x) const
200200
{
201201
throw NotImplementedException(
202202
A_FUNCINFO, "TrilinosInternalLinearAlgebra::reciprocal not implemented");
@@ -206,7 +206,7 @@ TrilinosInternalLinearAlgebra::reciprocal(Vector& x) const
206206

207207
void
208208
TrilinosInternalLinearAlgebra::pointwiseMult(
209-
const Vector& x, const Vector& y, Vector& w) const
209+
[[maybe_unused]] const Vector& x,[[maybe_unused]] const Vector& y,[[maybe_unused]] Vector& w) const
210210
{
211211
throw NotImplementedException(
212212
A_FUNCINFO, "TrilinosInternalLinearAlgebra::pointwiseMult not implemented");

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/algebra/TrilinosInternalLinearAlgebra.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ALIEN_TRILINOS_EXPORT TrilinosInternalLinearAlgebra
3030
: public IInternalLinearAlgebra<TrilinosMatrixType, TrilinosVectorType>
3131
{
3232
public:
33-
TrilinosInternalLinearAlgebra(Arccore::MessagePassing::IMessagePassingMng* pm = nullptr)
33+
TrilinosInternalLinearAlgebra(Arccore::MessagePassing::IMessagePassingMng* = nullptr)
3434
{
3535
}
3636

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/converters/SimpleCSR/SimpleCSR_to_Trilinos_MatrixConverter.cc

+1-7
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,11 @@ void
7777
SimpleCSR_to_Trilinos_MatrixConverter<TagT>::_build(
7878
const SimpleCSRMatrix<Real>& sourceImpl, TrilinosMatrix<Real, TagT>& targetImpl) const
7979
{
80-
typedef SimpleCSRMatrix<Real>::MatrixInternal CSRMatrixType;
81-
8280
const MatrixDistribution& dist = targetImpl.distribution();
83-
const CSRStructInfo& profile = sourceImpl.getCSRProfile();
84-
const Integer localSize = profile.getNRow();
8581
const Integer localOffset = dist.rowOffset();
8682
const Integer globalSize = dist.globalRowSize();
8783

8884
auto const& matrixInternal = *sourceImpl.internal();
89-
const Integer myRank = dist.parallelMng()->commRank();
90-
const Integer nProc = dist.parallelMng()->commSize();
9185

9286
auto const& matrix_profile = sourceImpl.internal()->getCSRProfile();
9387
int nrows = matrix_profile.getNRow();
@@ -104,7 +98,7 @@ SimpleCSR_to_Trilinos_MatrixConverter<TagT>::_build(
10498
template <typename TagT>
10599
void
106100
SimpleCSR_to_Trilinos_MatrixConverter<TagT>::_buildBlock(
107-
const SimpleCSRMatrix<Real>& sourceImpl, TrilinosMatrix<Real, TagT>& targetImpl) const
101+
[[maybe_unused]] const SimpleCSRMatrix<Real>& sourceImpl,[[maybe_unused]] TrilinosMatrix<Real, TagT>& targetImpl) const
108102
{
109103
}
110104

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/data_structure/TrilinosInternal.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050

5151
/* print callback (could be customized) */
52-
void print_callback(const char *msg, int length)
52+
void print_callback(const char *msg,[[maybe_unused]] int length)
5353
{
5454
int rank;
5555
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -116,7 +116,7 @@ TrilinosInternal::getEnv<std::string>(std::string const& key, std::string defaul
116116

117117
void
118118
TrilinosInternal::initialize(Arccore::MessagePassing::IMessagePassingMng* parallel_mng,
119-
std::string const& execution_space, int nb_threads, bool use_amgx)
119+
std::string const& execution_space, int nb_threads,[[maybe_unused]] bool use_amgx)
120120
{
121121
if (m_is_initialized)
122122
return;
@@ -569,7 +569,7 @@ void initAMGX(AMGXEnv& amgx_env,
569569
#endif
570570

571571
void
572-
TrilinosInternal::initMPIEnv(MPI_Comm comm)
572+
TrilinosInternal::initMPIEnv([[maybe_unused]] MPI_Comm comm)
573573
{
574574
}
575575

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/data_structure/TrilinosInternal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ BEGIN_TRILINOSINTERNAL_NAMESPACE
6969
//! Check parallel feature for MTL
7070
struct Features
7171
{
72-
static void checkParallel(const MatrixDistribution& dist) {}
72+
static void checkParallel([[maybe_unused]] const MatrixDistribution& dist) {}
7373
};
7474

7575
/*---------------------------------------------------------------------------*/

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/data_structure/TrilinosMatrix.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BEGIN_TRILINOSINTERNAL_NAMESPACE
1818
template <typename ValueT, typename TagT>
1919
bool
2020
MatrixInternal<ValueT, TagT>::initMatrix(int local_offset, int nrows, int const* kcol,
21-
int const* cols, int block_size, ValueT const* values)
21+
int const* cols,[[maybe_unused]] int block_size, ValueT const* values)
2222
{
2323
m_local_offset = local_offset;
2424
m_local_size = nrows;
@@ -76,7 +76,7 @@ MatrixInternal<ValueT, TagT>::mult(vector_type const& x, vector_type& y) const
7676

7777
template <typename ValueT, typename TagT>
7878
void
79-
MatrixInternal<ValueT, TagT>::mult(ValueT const* x, ValueT* y) const
79+
MatrixInternal<ValueT, TagT>::mult([[maybe_unused]] ValueT const* x,[[maybe_unused]] ValueT* y) const
8080
{
8181
// m_internal->apply(x,y) ;
8282
}

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/data_structure/TrilinosVector.cc

+1-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ template <typename ValueT, typename TagT> TrilinosVector<ValueT, TagT>::~Trilino
3434
template <typename ValueT, typename TagT>
3535
void
3636
TrilinosVector<ValueT, TagT>::init(
37-
const VectorDistribution& dist, const bool need_allocate)
37+
[[maybe_unused]] const VectorDistribution& dist, const bool need_allocate)
3838
{
3939
if (need_allocate)
4040
allocate();
@@ -73,12 +73,10 @@ TrilinosVector<ValueT, TagT>::setValues(const int nrow, const ValueT* values)
7373
x.sync_host();
7474
auto x_2d = x.getLocalViewHost();
7575
auto x_1d = Kokkos::subview(x_2d, Kokkos::ALL(), 0);
76-
const size_t localLength = x.getLocalLength();
7776
x.modify_host();
7877
#else
7978
auto x_2d = x.getLocalViewHost(Tpetra::Access::ReadWrite);
8079
auto x_1d = Kokkos::subview(x_2d, Kokkos::ALL(), 0);
81-
const size_t localLength = x.getLocalLength();
8280
#endif
8381

8482
for (int i = 0; i < nrow; ++i) {
@@ -104,7 +102,6 @@ TrilinosVector<ValueT, TagT>::getValues(const int nrow, ValueT* values) const
104102
auto x_2d = x.getLocalViewHost(Tpetra::Access::ReadWrite);
105103
#endif
106104
auto x_1d = Kokkos::subview(x_2d, Kokkos::ALL(), 0);
107-
const size_t localLength = x.getLocalLength();
108105
for (int i = 0; i < nrow; ++i) {
109106
values[i] = x_1d(i);
110107
// std::cout<<"GET X["<<i<<"]"<<values[i]<<std::endl ;

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/eigen_solver/TrilinosInternalEigenSolver.cc

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2+
//-----------------------------------------------------------------------------
3+
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4+
// See the top-level COPYRIGHT file for details.
5+
// SPDX-License-Identifier: Apache-2.0
6+
//-----------------------------------------------------------------------------
17

2-
/* Author : desrozis at Mon Mar 30 15:06:37 2009
3-
* Generated by createNew
4-
*/
58
#define MPICH_SKIP_MPICXX 1
69
#include "mpi.h"
710

@@ -40,7 +43,7 @@ TrilinosInternalEigenSolver::TrilinosInternalEigenSolver(
4043
}
4144

4245
void
43-
TrilinosInternalEigenSolver::init(int argc, char const** argv)
46+
TrilinosInternalEigenSolver::init([[maybe_unused]] int argc,[[maybe_unused]] char const** argv)
4447
{
4548
#ifdef ALIEN_USE_TRILINOSSOLVER
4649
// m_hts_solver.reset(new HartsSolver::HTSSolver()) ;
@@ -66,7 +69,7 @@ TrilinosInternalEigenSolver::getStatus() const
6669
}
6770

6871
bool
69-
TrilinosInternalEigenSolver::solve(EigenProblem& p)
72+
TrilinosInternalEigenSolver::solve([[maybe_unused]] EigenProblem& p)
7073
{
7174
using namespace Alien;
7275

@@ -78,7 +81,7 @@ TrilinosInternalEigenSolver::solve(EigenProblem& p)
7881
}
7982

8083
bool
81-
TrilinosInternalEigenSolver::solve(GeneralizedEigenProblem& p)
84+
TrilinosInternalEigenSolver::solve([[maybe_unused]] GeneralizedEigenProblem& p)
8285
{
8386
using namespace Alien;
8487

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/linear_solver/TrilinosInternalLinearSolver.cc

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2+
//-----------------------------------------------------------------------------
3+
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4+
// See the top-level COPYRIGHT file for details.
5+
// SPDX-License-Identifier: Apache-2.0
6+
//-----------------------------------------------------------------------------
17

2-
/* Author : desrozis at Mon Mar 30 15:06:37 2009
3-
* Generated by createNew
4-
*/
58
#define MPICH_SKIP_MPICXX 1
69
#include "mpi.h"
710

@@ -79,7 +82,7 @@ TrilinosInternalLinearSolver<TagT>::TrilinosInternalLinearSolver(
7982

8083
template <typename TagT>
8184
void
82-
TrilinosInternalLinearSolver<TagT>::init(int argc, char const** argv)
85+
TrilinosInternalLinearSolver<TagT>::init([[maybe_unused]] int argc,[[maybe_unused]] char const** argv)
8386
{
8487
}
8588

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/linear_solver/TrilinosInternalLinearSolver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ALIEN_TRILINOS_EXPORT TrilinosInternalLinearSolver
8383
String getName() const { return "trilinos"; }
8484

8585
//! Etat du solveur
86-
void setNullSpaceConstantOption(bool flag)
86+
void setNullSpaceConstantOption([[maybe_unused]] bool flag)
8787
{
8888
alien_warning([&] { cout() << "Null Space Constant Option not yet implemented"; });
8989
}

alien/ArcaneInterface/modules/trilinos/src/alien/kernels/trilinos/linear_solver/TrilinosInternalSolver.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ template <typename TagT> class SolverInternal
127127
Teuchos::RCP<const Teuchos::Comm<int>> m_comm;
128128

129129
public:
130-
void initPrecondParameters(IOptionsTrilinosSolver* options, MPI_Comm const* comm)
130+
void initPrecondParameters(IOptionsTrilinosSolver* options,[[maybe_unused]] MPI_Comm const* comm)
131131
{
132132
using Teuchos::ParameterList;
133133
using Teuchos::parameterList;
@@ -507,11 +507,11 @@ template <typename TagT> class SolverInternal
507507
Teuchos::RCP<Tpetra::Operator<scalar_type, local_ordinal_type, global_ordinal_type,
508508
node_type>>
509509
createPreconditioner(matrix_type& A,
510-
coord_type& A_coordinates,
510+
[[maybe_unused]] coord_type& A_coordinates,
511511
const std::string& precondType,
512512
Teuchos::RCP<Teuchos::ParameterList> plist,
513513
std::ostream& out,
514-
std::ostream& err)
514+
[[maybe_unused]] std::ostream& err)
515515
{
516516
using Teuchos::ParameterList;
517517
using Teuchos::RCP;

alien/ArcaneInterface/test/AlienBench/AlienBenchModule.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class AlienBenchModule : public ArcaneAlienBenchObject
9898
ARCCORE_HOST_DEVICE Real funcn(Real3 x) const;
9999
ARCCORE_HOST_DEVICE Real funck(Real3 x) const;
100100
Real dii(const Cell& ci) const;
101-
ARCCORE_HOST_DEVICE Real dii(Integer ci) const {
101+
ARCCORE_HOST_DEVICE Real dii([[maybe_unused]] Integer ci) const {
102102
return m_diag_coeff ;
103103
}
104104
Real fij(const Cell& ci, const Cell& cj) const;

0 commit comments

Comments
 (0)