Skip to content

Commit

Permalink
Support c++14 with warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ZamanLantra committed Nov 14, 2024
1 parent cbd8031 commit ea822fa
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
4 changes: 3 additions & 1 deletion app_fempic_cg/cuda/move_kernel_loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ void opp_particle_move__move_kernel(opp_set set, opp_map c2c_map, opp_map p2c_ma

opp_mem::dev_copy_to_symbol<OPP_INT>(cellMapper_pos_stride_d, &cellMapper_pos_stride, &(args[0].dat->set->set_capacity), 1);
opp_mem::dev_copy_to_symbol<OPP_INT>(OPP_rank_d, &OPP_rank, 1);

cutilSafeCall(cudaMemcpyToSymbol(opp_minSavedDHGrid_d, opp_minSavedDHGrid, 3 * sizeof(size_t)));
cutilSafeCall(cudaMemcpyToSymbol(opp_maxSavedDHGrid_d, opp_maxSavedDHGrid, 3 * sizeof(size_t)));

// check whether particles needs to be moved over global move routine
opp_dev_checkForGlobalMove3D_kernel<<<num_blocks, block_size>>>(
(OPP_REAL*)args[0].data_d, // p_pos
Expand Down
7 changes: 7 additions & 0 deletions opp_lib/include/device_kernels/cuda_inline_kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ __inline__ __device__ size_t opp_dev_findStructuredCellIndex3D(const OPP_REAL* p

// Calculate the cell index mapping index
const size_t index = xIndex + (yIndex * globalGridDims[0]) + (zIndex * globalGridDims[3]);

// printf("%lf %lf %lf - %lld %lld %lld -- MAX %lld %lld %lld -- MIN %lld %lld %lld -- out %d -- %lld\n",
// pos[0 * cellMapper_pos_stride_d], pos[1 * cellMapper_pos_stride_d], pos[2 * cellMapper_pos_stride_d],
// xIndex, yIndex, zIndex,
// opp_maxSavedDHGrid_d[0],opp_maxSavedDHGrid_d[1],opp_maxSavedDHGrid_d[2],
// opp_minSavedDHGrid_d[0],opp_minSavedDHGrid_d[1],opp_minSavedDHGrid_d[2],
// isOutOfCuboid ? 1 : 0, index);

return (isOutOfCuboid) ? MAX_CELL_INDEX : index;
}
Expand Down
9 changes: 6 additions & 3 deletions opp_lib/src/cuda/opp_direct_hop_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,10 @@ void dh_particle_packer_gpu::pack(opp_set set)

thrust::device_vector<OPP_INT>& temp_dv = *(set->mesh_relation_dat->thrust_int_sort);

for (const auto& [send_rank, part_ids_vec] : local_part_ids) {
for (const auto& a : local_part_ids) {

const int send_rank = a.first;
const std::vector<int>& part_ids_vec = a.second;
const size_t bytes_per_rank = (size_t)set->particle_size * part_ids_vec.size();

if (OPP_DBG)
Expand Down Expand Up @@ -948,8 +950,9 @@ void dh_particle_packer_gpu::unpack(opp_set set, const std::map<int, std::vector
}

size_t current_recv_count = 0;
for (const auto& [recv_rank, buffer] : part_recv_buffers) {

for (const auto& a : part_recv_buffers) {

const std::vector<char>& buffer = a.second;
const size_t recv_count = (buffer.size() / set->particle_size);
int64_t displacement = 0;

Expand Down
16 changes: 10 additions & 6 deletions opp_lib/src/mpi/opp_mpi_particle_comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,9 @@ void dh_particle_packer_cpu::pack(opp_set set)

opp_profiler->start("MvDH_Pack");

for (const auto& [send_rank, part_ids_vec] : local_part_ids) {
for (const auto& a : local_part_ids) {
const int send_rank = a.first;
const std::vector<OPP_INT>& part_ids_vec = a.second;

const size_t bytes_per_rank = (size_t)set->particle_size * part_ids_vec.size();

Expand Down Expand Up @@ -1024,7 +1026,9 @@ void GlobalParticleMover::communicate(opp_set set) {
this->h_send_rank_npart.resize(this->numRemoteSendRanks);

int rankx = 0;
for (const auto& [rank, indices_vec] : this->dh_local_part_indices) {
for (const auto& a : this->dh_local_part_indices) {
const int rank = a.first;
const std::vector<int>& indices_vec = a.second;

if (rank >= OPP_comm_size || rank < 0) {
opp_printf("GlobalParticleMover", "ERROR locking rank %d [size %zu] from rank %d",
Expand Down Expand Up @@ -1143,10 +1147,10 @@ void GlobalParticleMover::communicate(opp_set set) {

// (4) Once sent, map could be cleared for the set, keep the allocations if possible -----------

for (auto& [rank, vec] : this->dh_local_part_indices)
vec.clear();
for (auto& [rank, vec] : this->dh_foreign_cell_indices)
vec.clear();
for (auto& a : this->dh_local_part_indices)
a.second.clear();
for (auto& a : this->dh_foreign_cell_indices)
a.second.clear();

opp_profiler->end("MvDH_Comm");
}
Expand Down

0 comments on commit ea822fa

Please sign in to comment.