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

MPI datatype tweak #1064

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from
Draft
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
Prev Previous commit
Next Next commit
Define transfer type width in a single place
  • Loading branch information
lkotipal committed Dec 2, 2024
commit 484438c97a7a715aaa6f4365e5110121c879b7c4
4 changes: 2 additions & 2 deletions spatial_cell_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,12 +773,12 @@ namespace spatial_cell {
displacements.size(),
block_lengths.data(),
displacements.data(),
MPI_UINT32_T,
transferTypeMPI,
&datatype
);
} else {
count = 0;
datatype = MPI_UINT32_T;
datatype = transferTypeMPI;
}

const bool printMpiDatatype = false;
Expand Down
7 changes: 5 additions & 2 deletions spatial_cell_cpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ namespace spatial_cell {
vmesh::VelocityBlockContainer<vmesh::LocalID> blockContainer; /**< Velocity block data.*/
};

typedef uint8_t transferType;
constexpr MPI_Datatype transferTypeMPI MPI_BYTE;

class SpatialCell {
public:
SpatialCell();
Expand Down Expand Up @@ -364,7 +367,7 @@ namespace spatial_cell {
// if (sizeof(T) < 4) {
// abort_mpi("Pointer too small to cast to uint32_t!");
// }
return reinterpret_cast<const uint8_t*>(p) - reinterpret_cast<const uint8_t*>(this);
return reinterpret_cast<const transferType*>(p) - reinterpret_cast<const transferType*>(this);
}

template<typename T>
Expand All @@ -373,7 +376,7 @@ namespace spatial_cell {
// if (sizeof(T) < 4) {
// abort_mpi("Pointer too small to cast to uint32_t!");
// }
return len * sizeof(T) / sizeof(uint8_t);
return len * sizeof(T) / sizeof(transferType);
}

bool compute_block_has_content(const vmesh::GlobalID& block,const uint popID) const;
Expand Down
Loading