Skip to content

Commit

Permalink
Merge pull request #5 from dfvankomen/master
Browse files Browse the repository at this point in the history
fix: fixed a dvec bug where values weren't getting set if comm grew
  • Loading branch information
dfvankomen committed Dec 18, 2023
2 parents b8cd0c3 + 3b87ec9 commit 0ecc874
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
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

0 comments on commit 0ecc874

Please sign in to comment.