Skip to content

Commit

Permalink
Fix warnings. (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Dec 6, 2024
1 parent addef09 commit c8078c3
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.13
- uses: DoozyX/clang-format-lint-action@v0.18.2
with:
source: './app ./src'
exclude: '.'
extensions: 'H,h,cpp'
clangFormatVersion: 13
clangFormatVersion: 18
CPU:
needs: Formatting
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion app/exawind/exawind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int main(int argc, char** argv)
std::vector<int> num_nw_solver_ranks;
if (node["nalu_wind_procs"]) {
num_nw_solver_ranks = node["nalu_wind_procs"].as<std::vector<int>>();
if (num_nw_solver_ranks.size() != num_nwsolvers) {
if (static_cast<int>(num_nw_solver_ranks.size()) != num_nwsolvers) {
throw std::runtime_error(
"Number of Nalu-Wind rank specifications is less than the "
" number of Nalu-Wind solvers. Please have one rank count "
Expand Down
1 change: 0 additions & 1 deletion src/AMRTiogaIface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void AMRTiogaIface::register_mesh()
{
BL_PROFILE("exawind::AMRTiogaIface::register_mesh");
auto& mesh = m_sim.mesh();
const int nlevels = mesh.finestLevel() + 1;
const int num_ghost = m_sim.pde_manager().num_ghost_state();

auto* amr_tg_iface =
Expand Down
4 changes: 2 additions & 2 deletions src/AMRWind.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ class AMRWind : public ExawindSolver
void pre_advance_stage1(size_t inonlin) override;
void pre_advance_stage2(size_t inonlin) override;
void advance_timestep(size_t inonlin) override;
void additional_picard_iterations(const int) override{};
void additional_picard_iterations(const int) override {};
void post_advance() override;
void pre_overset_conn_work() override;
void post_overset_conn_work() override;
void register_solution() override;
void update_solution() override;
void dump_simulation_time() override{};
void dump_simulation_time() override {};
MPI_Comm m_comm;
};

Expand Down
2 changes: 1 addition & 1 deletion src/ExawindSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace exawind {
class ExawindSolver
{
public:
explicit ExawindSolver() : m_timers(m_names){};
explicit ExawindSolver() : m_timers(m_names) {};
virtual ~ExawindSolver();

void call_init_prolog(bool multi_solver_mode = true)
Expand Down
2 changes: 1 addition & 1 deletion src/MPIUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ create_subcomm(MPI_Comm comm, const int num_ranks, const int start_rank = 0)
MPI_Group world_group, sub_group;
MPI_Comm_group(comm, &world_group);

int sub_range[1][3] = {start_rank, start_rank + num_ranks - 1, 1};
int sub_range[1][3] = {{start_rank, start_rank + num_ranks - 1, 1}};
MPI_Group_range_incl(world_group, 1, sub_range, &sub_group);

MPI_Comm sub_comm;
Expand Down
2 changes: 1 addition & 1 deletion src/MemoryUsage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ long memory_usage()
getrusage(RUSAGE_SELF, &usage);

// convert to MB
return (long)((double)usage.ru_maxrss) / 1024.0;
return static_cast<long>(static_cast<double>(usage.ru_maxrss) / 1024.0);
}
#else
long memory_usage() { return -1; }
Expand Down
4 changes: 2 additions & 2 deletions src/NaluWind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NaluWind::NaluWind(
const std::string& logfile,
const std::vector<std::string>& fnames,
TIOGA::tioga& tg)
: m_id(id), m_comm(comm), m_doc(inp_yaml), m_fnames(fnames), m_sim(m_doc)
: m_doc(inp_yaml), m_sim(m_doc), m_fnames(fnames), m_id(id), m_comm(comm)
{
auto& env = sierra::nalu::NaluEnv::self();
env.parallelCommunicator_ = comm;
Expand Down Expand Up @@ -92,7 +92,7 @@ void NaluWind::pre_advance_stage2(size_t inonlin)
m_sim.timeIntegrator_->pre_realm_advance_stage2(inonlin);
}

void NaluWind::advance_timestep(size_t inonlin)
void NaluWind::advance_timestep(size_t /*inonlin*/)
{
for (auto* realm : m_sim.timeIntegrator_->realmVec_) {
realm->advance_time_step();
Expand Down
2 changes: 1 addition & 1 deletion src/NaluWind.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class NaluWind : public ExawindSolver
if (index >= 0) {
suffix = "_" + std::to_string(index) + suffix;
}
if (extloc != std::string::npos) {
if (extloc != static_cast<int>(std::string::npos)) {
logfile = inpfile.substr(0, extloc) + suffix;
}
return logfile;
Expand Down
7 changes: 4 additions & 3 deletions src/OversetSimulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ void OversetSimulation::run_timesteps(

m_timers_exa.tick("TimeStep");

for (size_t inonlin = 0; inonlin < nonlinear_its; inonlin++) {
for (size_t inonlin = 0; inonlin < static_cast<size_t>(nonlinear_its);
inonlin++) {

bool increment_timer = inonlin > 0 ? true : false;

Expand Down Expand Up @@ -260,8 +261,8 @@ long OversetSimulation::mem_usage_all(const int step)
}

fp << std::to_string(step);
for (const auto& mem : memall) {
fp << ' ' << mem;
for (const auto& m : memall) {
fp << ' ' << m;
}
fp << std::endl;
fp.close();
Expand Down
7 changes: 4 additions & 3 deletions src/Timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct Timers
Timers(const std::vector<std::string>& names) : m_names(names)
{
Timer clock;
for (const auto& name : names) {
for ([[maybe_unused]] const auto& name : names) {
m_timers.push_back(clock);
}
};
Expand Down Expand Up @@ -111,7 +111,7 @@ struct Timers

std::ostringstream outstream;
std::ostringstream linestream;
for (int i = 0; i < m_timers.size(); ++i) {
for (int i = 0; i < static_cast<int>(m_timers.size()); ++i) {
std::string func_call =
(m_timers.size() == 1) ? "Total" : m_names.at(i);

Expand All @@ -120,7 +120,8 @@ struct Timers
maxtimes.at(i));

outstream << linestream.str();
if (i < m_timers.size() - 1) outstream << std::endl;
if (i < static_cast<int>(m_timers.size()) - 1)
outstream << std::endl;
}

// accumulate only if there is more than 1 routine to report
Expand Down
2 changes: 1 addition & 1 deletion src/yaml-editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ inline void impl_find_and_replace(YAML::Node src, YAML::Node key)
// case 2: it's a list
//- pass the contents of the list recursively (order matters when
// looking for a match)
for (int i = 0; i < key.size(); ++i) {
for (int i = 0; i < static_cast<int>(key.size()); ++i) {
try {
impl_find_and_replace(src[i], key[i]);
} catch (YamlNodeMatchException& e) {
Expand Down

0 comments on commit c8078c3

Please sign in to comment.