Dear Bruno,
I still had problems as I first copy the array and then I store it in a
matrix for diffeerent frequencies.The result I got was differet whene using
few process compared to using 1 single process. I added the following code
and now works, is it right?
{
static Utilities::MPI::CollectiveMutex mutex;
Utilities::MPI::CollectiveMutex::ScopedLock lock(mutex, mpi_communicator);
tmparray.operator=(locally_relevant_solution);
for ( int j= 0; j < dof_handler.n_dofs(); ++j)
sol_matrix(freq_iter, j)=tmparray(j);
}
Thank you
El jueves, 17 de febrero de 2022 a las 14:57:50 UTC+1, [email protected]
escribió:
> Hello,
>
> You don't need to synchronize anything the function has an MPI_Barrier.
> This is the reason for the comment. If one processor call the function but
> the others don't, the code will hang.
>
> Best,
>
> Bruno
>
>
> On Thursday, February 17, 2022 at 4:01:32 AM UTC-5 [email protected]
> wrote:
>
>> Dear all,
>>
>> I am copying a distributed vector using the following function:
>>
>> Vector <https://www.dealii.org/current/doxygen/deal.II/classVector.html>
>> <Number>& Vector
>> <https://www.dealii.org/current/doxygen/deal.II/classVector.html><
>> Number >::operator=(const PETScWrappers::VectorBase
>> <https://www.dealii.org/current/doxygen/deal.II/classPETScWrappers_1_1VectorBase.html>
>> & v)
>>
>> In the documentation it is written:
>> "*Note that due to the communication model used in MPI, this operation
>> can only succeed if all processes do it at the same time when v is a
>> distributed vector: It is not possible for only one process to obtain a
>> copy of a parallel vector while the other jobs do something else."*
>>
>> I would like to ask how can I synchronize all the processes to call the
>> function operator() at the same time. Is there a barrier function or
>> similar?
>>
>> Thank you
>>
>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/7160aa40-c7bb-430e-8d3a-82ebb70d1b65n%40googlegroups.com.