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

fix: fixed a dvec bug where values weren't getting set if comm grew #5

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ kde
*.pdf
.vscode
.python-version

.cache/
12 changes: 7 additions & 5 deletions include/dvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ namespace ot
template<typename T,typename I>
void DVector<T,I>::create_vector(const ot::Mesh* pMesh, DVEC_TYPE type, DVEC_LOC loc, unsigned int dof, bool allocate_ghost)
{
if(!(pMesh->isActive()))
return;

// set the internal fields based on input for storage
m_dof = dof;
m_comm = pMesh->getMPICommunicator();
m_vec_type = type;
Expand All @@ -175,10 +173,14 @@ namespace ot
(allocate_ghost) ? m_size = pMesh->getAllElements().size() * m_dof : m_size = pMesh->getNumLocalMeshElements() * m_dof;
else
{
dendro_log(" unknown type in DVector");
dendro_log(" unknown type in DVector, expected a value between 0 and 3, got: " + std::to_string(m_vec_type));
MPI_Abort(m_comm,0);
}

// NOTE: we don't want to allocate the memory if we're not active. But we *must* have the vector initialized.
if(!(pMesh->isActive()))
return;

if(m_vec_loc == DVEC_LOC::HOST)
{
#ifdef __CUDACC__
Expand All @@ -196,7 +198,7 @@ namespace ot

}else
{
dendro_log(" unknown vector allocation location specified");
dendro_log(" unknown vector allocation location specified, should be HOST (0) or DEVICE (1), got: " + std::to_string(m_vec_loc));
MPI_Abort(m_comm,0);
}

Expand Down
Loading