wrtobin / las

Zero-overhead interfaces to Linear Algebraic data structures and Solvers
1 stars 1 forks source link

Probelm Destroying Sparse #32

Closed kumargp closed 6 years ago

kumargp commented 6 years ago

I face problem when I use:

void xgc_mesh::destroy_vecSparseMat(std::vector< las::Mat* >& vSpMat)
{
  for (int irho=0; irho < vSpMat.size(); ++irho)
  {  
     //TODO this causes crashes in the destroy phase
     if(NULL != vSpMat[irho])
       las::getMatBuilder<las::sparse>(0)->destroy(vSpMat[irho]);  //Problem
  }
  vSpMat.clear();
}

When I comment it out, the error goes away. I will try to test a standalone !.

wrtobin commented 6 years ago

Okay cool I will look at this and get a patch out first thing in the morning, thanks for the heads up.

wrtobin commented 6 years ago

This is related to #19

wrtobin commented 6 years ago

Hmm... the destroy() call is covered in the current sparse test case... are you destroying the Sparsity/CSR somewhere independently of this destroy call. Alternatively is the vSpMat[irho] a sparse matrix or a dense matrix, the destroy operation for the sparse shouldn't work on the dense and vice-versa.

kumargp commented 6 years ago

Thanks for checking. The problem was not in LAS. It was because not all the matrix placeholders were filled. I changed the vector to:

las::Mat* mat = nullptr; for(i..) vecMatrices[i] = mat;

Now the check (nullptr != mat) filters out it before trying to delete.
This means the underlying scatter operation is not done by all ranks ?.