Re: [petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
Yeah! I think! You are completely right! Thanks for your suggestion. I would 
definitely look at them! 

Thanks

Amir

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Thursday, March 22, 2018 2:25 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 2:18 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Sorry ! In fact, I am trying to construct the radius and theta coordinate for 
the circular domain I am having before going to the main local functions. I 
needed that for my local functions. 

 

It sounds like you are having trouble with parallel programming. Maybe get your 
stuff working in serial, and then

look at a book like Using MPI by Gropp, et.al <http://et.al> . or Scientific 
Computing by Eijkhout to understand more about parallelism.

 

  Thanks,

 

Matt

 

From: Matthew Knepley [mailto:knep...@gmail.com <mailto:knep...@gmail.com> ] 
Sent: Thursday, March 22, 2018 1:45 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn 
<mailto:mhbagh...@mail.sjtu.edu.cn> >
Cc: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> >
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 1:28 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

I am trying to fill a vector based on global coordinate.

 

You can see how this might be too vague for me to follow.

 

As I am trying to use VecGetValues() on the global coordinate,

 

Okay, this does not work for any parallel vector.

 

I find it that argument goes out of range, since I am using global numbering 
rather than local numbering.

 

It is not the numbering that is a problem. It is that parallel Vectors in PETSc 
are distributed. You cannot directly access

data you do not own. You can send it to one process (for example using 
VecScatterCreateToZero()), but this is of course

not scalable.

 

  Thanks,

 

Matt

 

From: Matthew Knepley [mailto:knep...@gmail.com <mailto:knep...@gmail.com> ] 
Sent: Wednesday, March 21, 2018 10:38 PM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn 
<mailto:mhbagh...@mail.sjtu.edu.cn> >
Cc: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> >
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hello

I am trying to create a global vector of coordinates based on the parallelized 
dm. I find it really hard to work with the local numbering, how can I manage to 
create a kind of numbering on global level so that I could easily access to the 
nodes based on the new numbering. Thanks for your time.

 

DMGetCoordinates() gives you a global vector.

DMGetCoordinatesLocal() gives you a local vector.

 

What are you trying to do?

 

  Thanks,

 

 Matt

 

Amir





 

-- 

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/ <http://www.caam.rice.edu/~mk51/> 





 

-- 

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/ <http://www.caam.rice.edu/~mk51/> 





 

-- 

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/ <http://www.caam.rice.edu/~mk51/> 



Re: [petsc-users] Global Numbering

2018-03-21 Thread Matthew Knepley
On Wed, Mar 21, 2018 at 2:18 PM, Mohammad Hassan Baghaei <
mhbagh...@mail.sjtu.edu.cn> wrote:

> Sorry ! In fact, I am trying to construct the radius and theta coordinate
> for the circular domain I am having before going to the main local
> functions. I needed that for my local functions.
>

It sounds like you are having trouble with parallel programming. Maybe get
your stuff working in serial, and then
look at a book like Using MPI by Gropp, et.al. or Scientific Computing by
Eijkhout to understand more about parallelism.

  Thanks,

Matt


> *From:* Matthew Knepley [mailto:knep...@gmail.com]
> *Sent:* Thursday, March 22, 2018 1:45 AM
> *To:* Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
> *Cc:* PETSc <petsc-users@mcs.anl.gov>
> *Subject:* Re: [petsc-users] Global Numbering
>
>
>
> On Wed, Mar 21, 2018 at 1:28 PM, Mohammad Hassan Baghaei <
> mhbagh...@mail.sjtu.edu.cn> wrote:
>
> I am trying to fill a vector based on global coordinate.
>
>
>
> You can see how this might be too vague for me to follow.
>
>
>
> As I am trying to use VecGetValues() on the global coordinate,
>
>
>
> Okay, this does not work for any parallel vector.
>
>
>
> I find it that argument goes out of range, since I am using global
> numbering rather than local numbering.
>
>
>
> It is not the numbering that is a problem. It is that parallel Vectors in
> PETSc are distributed. You cannot directly access
>
> data you do not own. You can send it to one process (for example using
> VecScatterCreateToZero()), but this is of course
>
> not scalable.
>
>
>
>   Thanks,
>
>
>
> Matt
>
>
>
> *From:* Matthew Knepley [mailto:knep...@gmail.com]
> *Sent:* Wednesday, March 21, 2018 10:38 PM
> *To:* Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
> *Cc:* PETSc <petsc-users@mcs.anl.gov>
> *Subject:* Re: [petsc-users] Global Numbering
>
>
>
> On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei <
> mhbagh...@mail.sjtu.edu.cn> wrote:
>
> Hello
>
> I am trying to create a global vector of coordinates based on the
> parallelized dm. I find it really hard to work with the local numbering,
> how can I manage to create a kind of numbering on global level so that I
> could easily access to the nodes based on the new numbering. Thanks for
> your time.
>
>
>
> DMGetCoordinates() gives you a global vector.
>
> DMGetCoordinatesLocal() gives you a local vector.
>
>
>
> What are you trying to do?
>
>
>
>   Thanks,
>
>
>
>  Matt
>
>
>
> Amir
>
>
>
>
>
> --
>
> 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/ <http://www.caam.rice.edu/~mk51/>
>
>
>
>
>
> --
>
> 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/ <http://www.caam.rice.edu/~mk51/>
>



-- 
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/ <http://www.caam.rice.edu/~mk51/>


Re: [petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
Sorry ! In fact, I am trying to construct the radius and theta coordinate for 
the circular domain I am having before going to the main local functions. I 
needed that for my local functions.

 

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Thursday, March 22, 2018 1:45 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 1:28 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

I am trying to fill a vector based on global coordinate.

 

You can see how this might be too vague for me to follow.

 

As I am trying to use VecGetValues() on the global coordinate,

 

Okay, this does not work for any parallel vector.

 

I find it that argument goes out of range, since I am using global numbering 
rather than local numbering.

 

It is not the numbering that is a problem. It is that parallel Vectors in PETSc 
are distributed. You cannot directly access

data you do not own. You can send it to one process (for example using 
VecScatterCreateToZero()), but this is of course

not scalable.

 

  Thanks,

 

Matt

 

From: Matthew Knepley [mailto:knep...@gmail.com <mailto:knep...@gmail.com> ] 
Sent: Wednesday, March 21, 2018 10:38 PM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn 
<mailto:mhbagh...@mail.sjtu.edu.cn> >
Cc: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> >
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hello

I am trying to create a global vector of coordinates based on the parallelized 
dm. I find it really hard to work with the local numbering, how can I manage to 
create a kind of numbering on global level so that I could easily access to the 
nodes based on the new numbering. Thanks for your time.

 

DMGetCoordinates() gives you a global vector.

DMGetCoordinatesLocal() gives you a local vector.

 

What are you trying to do?

 

  Thanks,

 

 Matt

 

Amir





 

-- 

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/ <http://www.caam.rice.edu/~mk51/> 





 

-- 

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/ <http://www.caam.rice.edu/~mk51/> 



Re: [petsc-users] Global Numbering

2018-03-21 Thread Matthew Knepley
On Wed, Mar 21, 2018 at 1:28 PM, Mohammad Hassan Baghaei <
mhbagh...@mail.sjtu.edu.cn> wrote:

> I am trying to fill a vector based on global coordinate.
>

You can see how this might be too vague for me to follow.


> As I am trying to use VecGetValues() on the global coordinate,
>

Okay, this does not work for any parallel vector.


> I find it that argument goes out of range, since I am using global
> numbering rather than local numbering.
>

It is not the numbering that is a problem. It is that parallel Vectors in
PETSc are distributed. You cannot directly access
data you do not own. You can send it to one process (for example using
VecScatterCreateToZero()), but this is of course
not scalable.

  Thanks,

Matt


> *From:* Matthew Knepley [mailto:knep...@gmail.com]
> *Sent:* Wednesday, March 21, 2018 10:38 PM
> *To:* Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
> *Cc:* PETSc <petsc-users@mcs.anl.gov>
> *Subject:* Re: [petsc-users] Global Numbering
>
>
>
> On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei <
> mhbagh...@mail.sjtu.edu.cn> wrote:
>
> Hello
>
> I am trying to create a global vector of coordinates based on the
> parallelized dm. I find it really hard to work with the local numbering,
> how can I manage to create a kind of numbering on global level so that I
> could easily access to the nodes based on the new numbering. Thanks for
> your time.
>
>
>
> DMGetCoordinates() gives you a global vector.
>
> DMGetCoordinatesLocal() gives you a local vector.
>
>
>
> What are you trying to do?
>
>
>
>   Thanks,
>
>
>
>  Matt
>
>
>
> Amir
>
>
>
>
>
> --
>
> 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/ <http://www.caam.rice.edu/~mk51/>
>



-- 
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/ <http://www.caam.rice.edu/~mk51/>


Re: [petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
I am trying to fill a vector based on global coordinate. As I am trying to use 
VecGetValues() on the global coordinate, I find it that argument goes out of 
range, since I am using global numbering rather than local numbering.

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Wednesday, March 21, 2018 10:38 PM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hello

I am trying to create a global vector of coordinates based on the parallelized 
dm. I find it really hard to work with the local numbering, how can I manage to 
create a kind of numbering on global level so that I could easily access to the 
nodes based on the new numbering. Thanks for your time.

 

DMGetCoordinates() gives you a global vector.

DMGetCoordinatesLocal() gives you a local vector.

 

What are you trying to do?

 

  Thanks,

 

 Matt

 

Amir





 

-- 

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/ <http://www.caam.rice.edu/~mk51/> 



Re: [petsc-users] Global Numbering

2018-03-21 Thread Matthew Knepley
On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei <
mhbagh...@mail.sjtu.edu.cn> wrote:

> Hello
>
> I am trying to create a global vector of coordinates based on the
> parallelized dm. I find it really hard to work with the local numbering,
> how can I manage to create a kind of numbering on global level so that I
> could easily access to the nodes based on the new numbering. Thanks for
> your time.
>
>
DMGetCoordinates() gives you a global vector.
DMGetCoordinatesLocal() gives you a local vector.

What are you trying to do?

  Thanks,

 Matt


> Amir
>



-- 
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/ 


[petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
Hello

I am trying to create a global vector of coordinates based on the
parallelized dm. I find it really hard to work with the local numbering, how
can I manage to create a kind of numbering on global level so that I could
easily access to the nodes based on the new numbering. Thanks for your time.

Amir



[petsc-users] Global numbering obtained via ISPartitioningToNumbering is inconsistent with the partitioning indexset

2012-04-09 Thread Mohammad Mirzadeh
Hi,

I am using  'ISPartitioningToNumbering' to generate new global numbering
from a partitioning indexset and I'm baffled at the following situation.
I'm debugging my code on a simple grid consisting of 81 grid points
partitioned among two processes. When I look into the partitioning indexset
(i.e. looking at the indecies via ISView) I can see that 40 points have
been assigned to proc 0 and 41 to processor 1. Isn't it true that when 81
points are distributed among two processors 41 should go to proc 0 and 40
to proc 1?

I have based my whole code on the assumption (verified before through
mailing list i guess) that natural ordering in PETSc leads to a
distribution of points such that all processors get the same number of
points ( [0, n/p) on proc 0, [n/p, 2n/p) on proc 1, ... ) unless n%p != 0,
in which case the first k (with k = n%p) processors receive 1 point extra.
Am I wrong to assume this?

Thanks,
Mohammad

PS: Is it relevant that the partitioning indexset is obtained via
ParMetis?partitiong
-- next part --
An HTML attachment was scrubbed...
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120409/1e5928c7/attachment.htm


[petsc-users] Global numbering obtained via ISPartitioningToNumbering is inconsistent with the partitioning indexset

2012-04-09 Thread Barry Smith

On Apr 9, 2012, at 5:06 PM, Mohammad Mirzadeh wrote:

 Hi,
 
 I am using  'ISPartitioningToNumbering' to generate new global numbering from 
 a partitioning indexset and I'm baffled at the following situation. I'm 
 debugging my code on a simple grid consisting of 81 grid points partitioned 
 among two processes. When I look into the partitioning indexset (i.e. looking 
 at the indecies via ISView) I can see that 40 points have been assigned to 
 proc 0 and 41 to processor 1. Isn't it true that when 81 points are 
 distributed among two processors 41 should go to proc 0 and 40 to proc 1? 
 
 I have based my whole code on the assumption (verified before through mailing 
 list i guess) that natural ordering in PETSc leads to a distribution of 
 points such that all processors get the same number of points ( [0, n/p) on 
 proc 0, [n/p, 2n/p) on proc 1, ... ) unless n%p != 0, in which case the first 
 k (with k = n%p) processors receive 1 point extra. Am I wrong to assume this?
 
 Thanks,
 Mohammad
 

 PS: Is it relevant that the partitioning indexset is obtained via 
 ParMetis?partitiong

   Yes, ParMetis provides no guarantee about how many points would get assigned 
to each process.

   Barry




[petsc-users] Global numbering obtained via ISPartitioningToNumbering is inconsistent with the partitioning indexset

2012-04-09 Thread Mohammad Mirzadeh
Aaah! Thanks Barry. Just to make sure though, is my assumption on the
natural ordering of PETSc correct?

Thanks

On Mon, Apr 9, 2012 at 3:10 PM, Barry Smith bsmith at mcs.anl.gov wrote:


 On Apr 9, 2012, at 5:06 PM, Mohammad Mirzadeh wrote:

  Hi,
 
  I am using  'ISPartitioningToNumbering' to generate new global numbering
 from a partitioning indexset and I'm baffled at the following situation.
 I'm debugging my code on a simple grid consisting of 81 grid points
 partitioned among two processes. When I look into the partitioning indexset
 (i.e. looking at the indecies via ISView) I can see that 40 points have
 been assigned to proc 0 and 41 to processor 1. Isn't it true that when 81
 points are distributed among two processors 41 should go to proc 0 and 40
 to proc 1?
 
  I have based my whole code on the assumption (verified before through
 mailing list i guess) that natural ordering in PETSc leads to a
 distribution of points such that all processors get the same number of
 points ( [0, n/p) on proc 0, [n/p, 2n/p) on proc 1, ... ) unless n%p != 0,
 in which case the first k (with k = n%p) processors receive 1 point extra.
 Am I wrong to assume this?
 
  Thanks,
  Mohammad
 

  PS: Is it relevant that the partitioning indexset is obtained via
 ParMetis?partitiong

Yes, ParMetis provides no guarantee about how many points would get
 assigned to each process.

   Barry



-- next part --
An HTML attachment was scrubbed...
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120409/a0fecbf8/attachment.htm


[petsc-users] Global numbering obtained via ISPartitioningToNumbering is inconsistent with the partitioning indexset

2012-04-09 Thread Jed Brown
On Mon, Apr 9, 2012 at 17:25, Mohammad Mirzadeh mirzadeh at gmail.com wrote:

 Just to make sure though, is my assumption on the natural ordering of
 PETSc correct?


Yes, but please don't write code that depends on that. It's plenty easy to
query the local size or the sizes/starts of other processes.
-- next part --
An HTML attachment was scrubbed...
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120409/0ad28fbe/attachment.htm


[petsc-users] Global numbering obtained via ISPartitioningToNumbering is inconsistent with the partitioning indexset

2012-04-09 Thread Mohammad Mirzadeh
Thanks Jed for the advice. Actually I looked at the code and I think this
was the only place I had made this implicit assumption (but the most
important place). As a matter of fact, I make my vectors layout according
to the AO that I get from partitioning. I think my main mistake was that I
had assumed the partitioning uses the same ordering as the PETSc ordering.

The code seems to run correctly now :)





On Mon, Apr 9, 2012 at 5:09 PM, Jed Brown jedbrown at mcs.anl.gov wrote:

 On Mon, Apr 9, 2012 at 17:25, Mohammad Mirzadeh mirzadeh at gmail.comwrote:

 Just to make sure though, is my assumption on the natural ordering of
 PETSc correct?


 Yes, but please don't write code that depends on that. It's plenty easy to
 query the local size or the sizes/starts of other processes.

-- next part --
An HTML attachment was scrubbed...
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120409/4d31b0fa/attachment.htm