Re: [petsc-users] Matrix version of VecScatterCreateToAll

2022-12-18 Thread Matthew Knepley
On Sun, Dec 18, 2022 at 9:44 AM 김성익  wrote:

> For example, before using preallocaotor, I made A matrix. (A matrix has
> information about indices of global matrix)
> And the code structures are as below.
> for (int i=0; iMatGetRow(A,~~) // for getting indices info of global matrix.
>MatSetvalues(preallocator, value_from_A);
> }
> Current state, I got an error at 'MatGetRow' when I run this code in
> parallel.
> That's why I want "all mpi ranks has information of A matrix".
>

Just from your explanation, this does not sound like a scalable algorithm
for this, and FEM should be scalable.
I would take a look at some parallel FEM codes before settling on this
structure.

However, if you really wish to do this, you can create the original matrix
and then call

  https://petsc.org/main/docs/manualpages/Mat/MatCreateSubMatrices/

with every process giving all indices as the argument.

  Thanks,

Matt


> Thanks,
> Hyung Kim
>
>
> 2022년 12월 18일 (일) 오후 11:36, Junchao Zhang 님이 작성:
>
>> I am not clear on what you said "this information must be viewed in all
>> mpi ranks."  Even with preallocator, each rank only needs to insert entries
>> it knows (i.e., don't need to get all entries)
>>
>> Maybe you could provide an example code for us to better understand what
>> you mean?
>>
>> --Junchao Zhang
>>
>>
>> On Sun, Dec 18, 2022 at 8:25 AM 김성익  wrote:
>>
>>> Hello,
>>>
>>>
>>> Is there a matrix version function of VecScatterCreateToAll?
>>>
>>> I'm using preallocator for preallocation of global matrix.
>>> Prior to using the preallocator, information related to allocation is
>>> stored in the specific matrix, and this information must be viewed in all
>>> mpi ranks.
>>> For using preallocator, I need scattering the specific matrix info to
>>> all mpi ranks.
>>>
>>> Thanks,
>>> Hyung Kim
>>>
>>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] dmplex normal vector incorrect for periodic gmsh grids

2022-12-18 Thread Matthew Knepley
On Sun, Dec 18, 2022 at 9:21 AM Jed Brown  wrote:

> Matthew Knepley  writes:
>
> > On Fri, Dec 16, 2022 at 12:22 AM Praveen C  wrote:
> >
> >> Thank you very much. I do see correct normals now.
> >>
> >> Is there a way to set the option
> >>
> >> -dm_localize_height 1
> >>>
> >>
> >> within the code ?
> >>
> >
> > The problem is that the localization happens within the Gmsh
> construction,
> > so it is difficult to insert an API.
> > We could use a callback, but that rapidly becomes unwieldy. If you want
> to
> > do it programmatically, I would use
> > PetscOptionsSetValue().
>
> Can it not be created explicitly later?
>
> This kind of thing isn't really a run-time choice, but rather a statement
> about the way the calling code has been written.
>

You could tear down the localization, then set the height, and recreate the
localization.

  Thanks,

 Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] Matrix version of VecScatterCreateToAll

2022-12-18 Thread 김성익
For example, before using preallocaotor, I made A matrix. (A matrix has
information about indices of global matrix)
And the code structures are as below.
for (int i=0; i님이 작성:

> I am not clear on what you said "this information must be viewed in all
> mpi ranks."  Even with preallocator, each rank only needs to insert entries
> it knows (i.e., don't need to get all entries)
>
> Maybe you could provide an example code for us to better understand what
> you mean?
>
> --Junchao Zhang
>
>
> On Sun, Dec 18, 2022 at 8:25 AM 김성익  wrote:
>
>> Hello,
>>
>>
>> Is there a matrix version function of VecScatterCreateToAll?
>>
>> I'm using preallocator for preallocation of global matrix.
>> Prior to using the preallocator, information related to allocation is
>> stored in the specific matrix, and this information must be viewed in all
>> mpi ranks.
>> For using preallocator, I need scattering the specific matrix info to all
>> mpi ranks.
>>
>> Thanks,
>> Hyung Kim
>>
>


Re: [petsc-users] Matrix version of VecScatterCreateToAll

2022-12-18 Thread Junchao Zhang
I am not clear on what you said "this information must be viewed in all mpi
ranks."  Even with preallocator, each rank only needs to insert entries it
knows (i.e., don't need to get all entries)

Maybe you could provide an example code for us to better understand what
you mean?

--Junchao Zhang


On Sun, Dec 18, 2022 at 8:25 AM 김성익  wrote:

> Hello,
>
>
> Is there a matrix version function of VecScatterCreateToAll?
>
> I'm using preallocator for preallocation of global matrix.
> Prior to using the preallocator, information related to allocation is
> stored in the specific matrix, and this information must be viewed in all
> mpi ranks.
> For using preallocator, I need scattering the specific matrix info to all
> mpi ranks.
>
> Thanks,
> Hyung Kim
>


[petsc-users] Matrix version of VecScatterCreateToAll

2022-12-18 Thread 김성익
Hello,


Is there a matrix version function of VecScatterCreateToAll?

I'm using preallocator for preallocation of global matrix.
Prior to using the preallocator, information related to allocation is
stored in the specific matrix, and this information must be viewed in all
mpi ranks.
For using preallocator, I need scattering the specific matrix info to all
mpi ranks.

Thanks,
Hyung Kim


Re: [petsc-users] dmplex normal vector incorrect for periodic gmsh grids

2022-12-18 Thread Jed Brown
Matthew Knepley  writes:

> On Fri, Dec 16, 2022 at 12:22 AM Praveen C  wrote:
>
>> Thank you very much. I do see correct normals now.
>>
>> Is there a way to set the option
>>
>> -dm_localize_height 1
>>>
>>
>> within the code ?
>>
>
> The problem is that the localization happens within the Gmsh construction,
> so it is difficult to insert an API.
> We could use a callback, but that rapidly becomes unwieldy. If you want to
> do it programmatically, I would use
> PetscOptionsSetValue().

Can it not be created explicitly later?

This kind of thing isn't really a run-time choice, but rather a statement about 
the way the calling code has been written.