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

This fixes a set of warnings and other minor system-specific issues #645

Open
wants to merge 3 commits into
base: 1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 8 additions & 4 deletions flecsi/coloring/crs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ namespace coloring {
// Convenience macro to avoid having to reimplement this for each member.
//----------------------------------------------------------------------------//

// initialize with an explicit loop to circumvent integral conversion warnings
#define define_as(member) \
template<typename T> \
std::vector<T> member##_as() const { \
std::vector<T> asvec(member.begin(), member.end()); \
std::vector<T> asvec; \
asvec.reserve(member.size()); \
for(auto v : member) \
asvec.push_back(static_cast<T>(v)); \
return asvec; \
}

Expand Down Expand Up @@ -255,10 +259,10 @@ operator<<(std::ostream & stream, const crs_t & crs) {
struct dcrs_t : public crs_t {
std::vector<size_t> distribution;

define_as(distribution)
define_as(distribution);

/// \brief clears the current storage
void clear() {
/// \brief clears the current storage
void clear() {
crs_t::clear();
distribution.clear();
}
Expand Down
56 changes: 30 additions & 26 deletions flecsi/coloring/dcrs_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ alltoallv(const SEND_TYPE & sendbuf,
auto buf = recvbuf.data() + recvdispls[rank];
requests.resize(requests.size() + 1);
auto & my_request = requests.back();
auto ret =
MPI_Irecv(buf, count, mpi_recv_t, rank, tag, comm, &my_request);
auto ret = MPI_Irecv(buf, static_cast<int>(count), mpi_recv_t,
static_cast<int>(rank), tag, comm, &my_request);
if(ret != MPI_SUCCESS)
return ret;
}
Expand All @@ -335,16 +335,17 @@ alltoallv(const SEND_TYPE & sendbuf,
auto buf = sendbuf.data() + senddispls[rank];
requests.resize(requests.size() + 1);
auto & my_request = requests.back();
auto ret =
MPI_Isend(buf, count, mpi_send_t, rank, tag, comm, &my_request);
auto ret = MPI_Isend(buf, static_cast<int>(count), mpi_send_t,
static_cast<int>(rank), tag, comm, &my_request);
if(ret != MPI_SUCCESS)
return ret;
}
}

// wait for everything to complete
std::vector<MPI_Status> status(requests.size());
auto ret = MPI_Waitall(requests.size(), requests.data(), status.data());
auto ret = MPI_Waitall(
static_cast<int>(requests.size()), requests.data(), status.data());

return ret;
}
Expand Down Expand Up @@ -436,7 +437,7 @@ make_dcrs_distributed(

size_t max_global_vert_id{0};
for(auto v : vertex_local_to_global)
max_global_vert_id = std::max(max_global_vert_id, v);
max_global_vert_id = (std::max)(max_global_vert_id, v);

// now the global max id
size_t tot_verts{0};
Expand Down Expand Up @@ -1096,9 +1097,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
std::vector<size_t> recvcounts(comm_size);
auto ret = MPI_Alltoall(sendcounts.data(), 1, mpi_size_t, recvcounts.data(),
1, mpi_size_t, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertex counts");

}
// how much info will we be receiving
std::vector<size_t> recvdispls(comm_size + 1);
recvdispls[0] = 0;
Expand All @@ -1112,9 +1113,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// now send the actual vertex info
ret = alltoallv(sendbuf, sendcounts, senddispls, recvbuf, recvcounts,
recvdispls, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertices");

}
//----------------------------------------------------------------------------
// Unpack results
//----------------------------------------------------------------------------
Expand Down Expand Up @@ -1149,7 +1150,7 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// first figure out the maximum global id on this rank
size_t max_global_ent_id{0};
for(auto v : local2global)
max_global_ent_id = std::max(max_global_ent_id, v);
max_global_ent_id = (std::max)(max_global_ent_id, v);

// now the global max id
size_t tot_ents{0};
Expand Down Expand Up @@ -1217,9 +1218,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// send counts
ret = MPI_Alltoall(sendcounts.data(), 1, mpi_size_t, recvcounts.data(), 1,
mpi_size_t, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertex counts");

}
// how much info will we be receiving
recvdispls[0] = 0;
for(size_t r = 0; r < comm_size; ++r)
Expand All @@ -1231,8 +1232,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// now send the actual vertex info
ret = alltoallv(sendbuf, sendcounts, senddispls, recvbuf, recvcounts,
recvdispls, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertices");
}

// upack results
for(size_t r = 0; r < comm_size; ++r) {
Expand Down Expand Up @@ -1293,8 +1295,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// send counts
ret = MPI_Alltoall(sendcounts.data(), 1, mpi_size_t, recvcounts.data(), 1,
mpi_size_t, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertex counts");
}

// how much info will we be receiving
recvdispls[0] = 0;
Expand All @@ -1307,9 +1310,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// now send the actual vertex info
ret = alltoallv(sendbuf, sendcounts, senddispls, recvbuf, recvcounts,
recvdispls, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertices");

}
// upack results
for(size_t r = 0; r < comm_size; ++r) {
for(size_t i = recvdispls[r]; i < recvdispls[r + 1]; i++) {
Expand Down Expand Up @@ -1378,9 +1381,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// send counts
ret = MPI_Alltoall(sendcounts.data(), 1, mpi_size_t, recvcounts.data(), 1,
mpi_size_t, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertex counts");

}
// how much info will we be receiving
recvdispls[0] = 0;
for(size_t r = 0; r < comm_size; ++r)
Expand All @@ -1392,8 +1395,9 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
// now send the actual vertex info
ret = alltoallv(sendbuf, sendcounts, senddispls, recvbuf, recvcounts,
recvdispls, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertices");
}

// upack results
for(size_t r = 0; r < comm_size; ++r) {
Expand Down Expand Up @@ -1428,7 +1432,7 @@ color_entities(const flecsi::coloring::crs_t & cells2entity,
}

// shared and ghost
for(const auto pair : entities2rank) {
for(const auto & pair : entities2rank) {
auto global_id = pair.first;
auto owner = pair.second;
// if i am the owner, shared
Expand Down Expand Up @@ -1484,7 +1488,7 @@ match_ids(

size_t max_global_vert_id{0};
for(auto v : vertex_local2global)
max_global_vert_id = std::max(max_global_vert_id, v);
max_global_vert_id = (std::max)(max_global_vert_id, v);

// now the global max id
size_t tot_verts{0};
Expand Down Expand Up @@ -1808,9 +1812,9 @@ ghost_connectivity(const flecsi::coloring::crs_t & from2to,
std::vector<size_t> recvcounts(comm_size);
auto ret = MPI_Alltoall(sendcounts.data(), 1, mpi_size_t, recvcounts.data(),
1, mpi_size_t, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertex counts");

}
// how much info will we be receiving
std::vector<size_t> recvdispls(comm_size + 1);
recvdispls[0] = 0;
Expand All @@ -1821,9 +1825,9 @@ ghost_connectivity(const flecsi::coloring::crs_t & from2to,
// now send the actual vertex info
ret = alltoallv(sendbuf, sendcounts, senddispls, recvbuf, recvcounts,
recvdispls, MPI_COMM_WORLD);
if(ret != MPI_SUCCESS)
if(ret != MPI_SUCCESS) {
clog_error("Error communicating vertices");

}
//----------------------------------------------------------------------------
// Unpack results
//----------------------------------------------------------------------------
Expand Down
9 changes: 5 additions & 4 deletions flecsi/coloring/parmetis_colorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ struct parmetis_colorer_t : public colorer_t {
idx_t wgtflag = 0;
idx_t numflag = 0;
idx_t ncon = 1;
std::vector<real_t> tpwgts(ncon * size, 1.0 / size);
std::vector<real_t> tpwgts(ncon * size, static_cast<real_t>(1.0 / size));

// We may need to expose some of the ParMETIS configuration options.
std::vector<real_t> ubvec(ncon, 1.05);
std::vector<real_t> ubvec(ncon, static_cast<real_t>(1.05));
idx_t options[3] = {0, 0, 0};
idx_t edgecut;
MPI_Comm comm = MPI_COMM_WORLD;
std::vector<idx_t> part(dcrs.size(), std::numeric_limits<idx_t>::max());
std::vector<idx_t> part(dcrs.size(), (std::numeric_limits<idx_t>::max)());

// Get the dCRS information using ParMETIS types.
std::vector<idx_t> vtxdist = dcrs.distribution_as<idx_t>();
Expand All @@ -281,8 +281,9 @@ struct parmetis_colorer_t : public colorer_t {
int result = ParMETIS_V3_PartKway(&vtxdist[0], &xadj[0], &adjncy[0],
nullptr, nullptr, &wgtflag, &numflag, &ncon, &size, &tpwgts[0],
ubvec.data(), options, &edgecut, &part[0], &comm);
if(result != METIS_OK)
if(result != METIS_OK) {
clog_error("Parmetis failed!");
}

std::vector<size_t> partitioning(part.begin(), part.end());

Expand Down
6 changes: 4 additions & 2 deletions flecsi/data/common/registration_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ struct field_registration_wrapper_u {
// register custom serdez op, if applicable
if constexpr(STORAGE_CLASS == ragged) {
using serdez_t = serdez_u<row_vector_u<DATA_TYPE>>;
execution::context_t::instance().register_serdez<serdez_t>(fid);
execution::context_t::instance().register_serdez<serdez_t>(
static_cast<int32_t>(fid));
} // if
else if constexpr(STORAGE_CLASS == sparse) {
using serdez_t = serdez_u<row_vector_u<sparse_entry_value_u<DATA_TYPE>>>;
execution::context_t::instance().register_serdez<serdez_t>(fid);
execution::context_t::instance().register_serdez<serdez_t>(
static_cast<int32_t>(fid));
}
} // register_callback

Expand Down
2 changes: 1 addition & 1 deletion flecsi/data/common/row_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct row_vector_u {
}

void assign(const_iterator first, const_iterator last) {
resize(last - first);
resize(static_cast<uint32_t>(last - first));
std::copy(first, last, datap);
}

Expand Down
2 changes: 1 addition & 1 deletion flecsi/data/data_client_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct data_client_handle_base_u : public DATA_CLIENT_TYPE,
data_client_handle_base_u(const data_client_handle_base_u<DATA_CLIENT_TYPE,
UNMAPPED_PERMISSIONS,
DATA_POLICY> & h)
: DATA_POLICY(h), DATA_CLIENT_TYPE(h), type_hash(h.type_hash),
: DATA_CLIENT_TYPE(h), DATA_POLICY(h), type_hash(h.type_hash),
name_hash(h.name_hash), namespace_hash(h.namespace_hash) {
static_assert(
UNMAPPED_PERMISSIONS == 0, "passing mapped client handle to task args");
Expand Down
2 changes: 1 addition & 1 deletion flecsi/data/ragged_accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ struct accessor_u<data::ragged,
auto & row = this->handle.rows[index];
assert(ragged_index < row.size() && "ragged accessor: index out of range");

return row[ragged_index];
return row[static_cast<int>(ragged_index)];
} // operator ()

const T & operator()(size_t index, size_t ragged_index) const {
Expand Down
5 changes: 2 additions & 3 deletions flecsi/data/ragged_mutator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ struct mutator_u<data::ragged, T> : public mutator_u<data::base, T>,

T & operator()(size_t index, size_t ragged_index) {
auto & row = this->handle[index];
return row[ragged_index];

return row[static_cast<uint32_t>(ragged_index)];
} // operator ()

void resize(size_t index, size_t size) {
auto & row = this->handle[index];
row.resize(size);
row.resize(static_cast<uint32_t>(size));
} // resize

void erase(size_t index, size_t ragged_index) {
Expand Down
11 changes: 6 additions & 5 deletions flecsi/execution/remap_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ remap_shared_entities() {
buf.resize(n);
requests.resize(requests.size() + 1);
auto & my_request = requests.back();
auto ret = MPI_Irecv(
buf.data(), n, mpi_size_t, rank, tag, MPI_COMM_WORLD, &my_request);
auto ret = MPI_Irecv(buf.data(), static_cast<int>(n), mpi_size_t,
static_cast<int>(rank), tag, MPI_COMM_WORLD, &my_request);
}
}

Expand All @@ -92,13 +92,14 @@ remap_shared_entities() {
const auto & buf = comm_pair.second;
requests.resize(requests.size() + 1);
auto & my_request = requests.back();
auto ret = MPI_Isend(buf.data(), buf.size(), mpi_size_t, rank, tag,
MPI_COMM_WORLD, &my_request);
auto ret = MPI_Isend(buf.data(), static_cast<int>(buf.size()), mpi_size_t,
static_cast<int>(rank), tag, MPI_COMM_WORLD, &my_request);
}

// wait for everything to complete
std::vector<MPI_Status> status(requests.size());
MPI_Waitall(requests.size(), requests.data(), status.data());
MPI_Waitall(
static_cast<int>(requests.size()), requests.data(), status.data());

// now we can unpack the messages and reconstruct the ghost entities
std::set<flecsi::coloring::entity_info_t> new_ghost;
Expand Down
4 changes: 2 additions & 2 deletions flecsi/execution/test/data_client_handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fill_task(client_handle_t<test_mesh_t, ro> mesh,
dense_accessor<double, rw, rw, na> pressure) {
size_t count = 0;
for(auto c : mesh.cells()) {
pressure(c) = count++;
pressure(c) = static_cast<double>(count++);
} // for
} // fill_task

Expand All @@ -57,7 +57,7 @@ print_task(client_handle_t<test_mesh_t, ro> mesh,
CINCH_CAPTURE() << "vertex id: " << v->id() << std::endl;
} // for

clog(info) << "presure: " << pressure(c) << std::endl;
clog(info) << "pressure: " << pressure(c) << std::endl;
} // for

} // print_task
Expand Down
1 change: 1 addition & 0 deletions flecsi/execution/test/devel_handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <cinchdevel.h>

#include <flecsi/data/data.h>
#include <flecsi/data/dense_accessor.h>
#include <flecsi/execution/context.h>
#include <flecsi/execution/execution.h>
Expand Down
4 changes: 2 additions & 2 deletions flecsi/execution/test/finite_difference_dense.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ flecsi_register_task(init, flecsi::execution, loc, index);
void
check_results(mesh<ro> mesh, field<ro, ro, ro> values, size_t global_target) {
auto target = flecsi_get_global_object(global_target, global, vec_2d_t);
auto rank = context_t::instance().color();
size_t rank = context_t::instance().color();

for(auto c : mesh.cells(owned)) {
auto v = values(c);
Expand All @@ -115,7 +115,7 @@ check_results(mesh<ro> mesh, field<ro, ro, ro> values, size_t global_target) {
auto t = (*target)[i][j];

if(std::abs(v - t) > test_tolerance) {
printf("[Rank %lu] at [%lu,%lu] %.15e != %.15e\n", rank, i, j, v, t);
printf("[Rank %zu] at [%zu,%zu] %.15e != %.15e\n", rank, i, j, v, t);
throw std::runtime_error("Got wrong result");
}
}
Expand Down
4 changes: 2 additions & 2 deletions flecsi/execution/test/finite_difference_sparse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ check_results(mesh<ro> mesh,
size_t field_idx,
size_t global_target) {
auto target = flecsi_get_global_object(global_target, global, vec_2d_t);
auto rank = context_t::instance().color();
size_t rank = context_t::instance().color();

for(auto c : mesh.cells(owned)) {
auto v = values(c, field_idx);
Expand All @@ -113,7 +113,7 @@ check_results(mesh<ro> mesh,
auto t = (*target)[i][j];

if(std::abs(v - t) > test_tolerance) {
printf("[Rank %lu] at [%lu,%lu] %.15e != %.15e\n", rank, i, j, v, t);
printf("[Rank %zu] at [%zu,%zu] %.15e != %.15e\n", rank, i, j, v, t);
throw std::runtime_error("Got wrong result");
}
}
Expand Down
Loading