- Thank you received: 0
Data Race Condition while using AddElementMatrixSymmetric
5 years 10 months ago #1369
by jhauser
Replied by jhauser on topic Data Race Condition while using AddElementMatrixSymmetric
With this I get the error:
‘class std::shared_ptr<ngla::SparseMatrixSymmetric<double> >’ has no member named ‘SetZero’
I used
as a work around, but I still get a similar wrong matrix. Different every time I run the program.
At least with the python script. (I use python 3 to execute it) If I use "MyMaxwellAssembleSMALL" in jupyter notebook, I get the correct matrix. (which is printed in my terminal, when I use this function)
‘class std::shared_ptr<ngla::SparseMatrixSymmetric<double> >’ has no member named ‘SetZero’
I used
Code:
for(int i=0; i<ndof_y;i++)
{
FlatVector<double> mat_rowvals = maty->GetRowValues(i);
for (int k=0; k<mat_rowvals.Size(); k++)
{
mat_rowvals[k]=0.0;
}
}
At least with the python script. (I use python 3 to execute it) If I use "MyMaxwellAssembleSMALL" in jupyter notebook, I get the correct matrix. (which is printed in my terminal, when I use this function)
5 years 10 months ago #1370
by joachim
if matrix is a shared pointer
Replied by joachim on topic Data Race Condition while using AddElementMatrixSymmetric
Code:
matrix -> SetZero()
5 years 10 months ago #1371
by jhauser
Replied by jhauser on topic Data Race Condition while using AddElementMatrixSymmetric
Oh, you're absolutely right. Thank you!
However the problem still remains. This doesn't change the every changing entries of the matrix. It's still different every time I run it.
However the problem still remains. This doesn't change the every changing entries of the matrix. It's still different every time I run it.
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 10 months ago #1373
by christopher
Replied by christopher on topic Data Race Condition while using AddElementMatrixSymmetric
With maty->SetZero() I get consistent results, can you repost the new version of your code?
to get the output in jupyter (you need to include pybind11/pybind11.h to have that).
This is because jupyter pipes only the python stdout and not the c++ one. You can use(which is printed in my terminal, when I use this function)
Code:
pybind11::print(maty)
5 years 10 months ago #1375
by jhauser
Replied by jhauser on topic Data Race Condition while using AddElementMatrixSymmetric
I cleaned out the cmake-files of ml-ngs and build/compiled everything anew.
Now it works. I have absolutly no idea why it didn't work before since I haven't changed the code.
Thank you very much for your time! I am sorry, that it took so long.
And thank you for the jupyter suggestion.
Now it works. I have absolutly no idea why it didn't work before since I haven't changed the code.
Thank you very much for your time! I am sorry, that it took so long.
And thank you for the jupyter suggestion.
Time to create page: 0.094 seconds