Creating a new vector based on a already distributed set of Vecs

Vijay S. Mahadevan vijay.m at gmail.com
Sun Mar 23 16:03:18 CDT 2008


Matt,

> You would like a single Vec which is the concatenation of a set of
> distributed Vecs.

Yes. But I do not intend to allocate memory separately for the single Vec
but rather it just acts like an interface to the original, individual
vector.

I am not worried about optimization yet and hence this is not entirely
because of memory concerns. 

I am trying to use JFNK technique to solve a coupled problem. Since each
physics knows its mesh and the optimal layout, it is best to let the physics
object create and distribute the solution and residual vector. A global
coupler would then only have to call the residuals on the individual physics
to assemble the total residual. If I do not have a pointer to the physics
residuals for the global residual, which is passed to SNESSolve, I then
would have to take out the individual components from the global residual
belonging to a single physics and then call its residual function. And that
has to be done for every single residual call from SNES. That IMO is a far
bigger computational issue that can be resolved by creating this interface
vector. If you still think this is not the way to go, that is fine.

Thanks for the help.

Vijay 

-----Original Message-----
From: owner-petsc-users at mcs.anl.gov [mailto:owner-petsc-users at mcs.anl.gov]
On Behalf Of Matthew Knepley
Sent: Sunday, March 23, 2008 3:33 PM
To: petsc-users at mcs.anl.gov
Subject: Re: Creating a new vector based on a already distributed set of
Vecs

2008/3/23 Vijay S. Mahadevan <vijay.m at gmail.com>:
> There is more than 1 vector involved, with different data and layout
>  dependent on the physics and mesh. Since the different Vec objects in
>  systems have their own layout, I do not want to modify them or recreate
>  them. I just want to create an interface vector so that I can pass it on
to
>  SNESSolve without having the hassle of synchronizing the individual
vectors
>  in each system.
>
>  I am writing a multi-physics code and this global vector concept could be
>  applied to the global nonlinear residual and the global solution vector.
It
>  doesn't make sense to recreate an entirely new vector and synchronizing
>  these at every call to the residual. And there lies my motivation. But if
>  you see an alternative way to approach this, I would be glad to hear it !

You would like a single Vec which is the concatenation of a set of
distributed
Vecs. I think this is needless economizing. If you are solving systems, the
memory involved in the Mat, PC, and KSP will swamp one vector. I would get
the code working first. Then if you really need this memory savings, you can
extract the pointer from the global vector and use it to create several
smaller
vectors. However, as I said, I think it is unnecessary.

  Matt

>  Sorry if I wasn't too clear before.
>  -----Original Message-----
>  From: owner-petsc-users at mcs.anl.gov
[mailto:owner-petsc-users at mcs.anl.gov]
>  On Behalf Of Matthew Knepley
>  Sent: Sunday, March 23, 2008 3:13 PM
>  To: petsc-users at mcs.anl.gov
>  Subject: Re: Creating a new vector based on a already distributed set of
>  Vecs
>
>  2008/3/23 Vijay S. Mahadevan <vijay.m at gmail.com>:
>  > Hi all,
>  >
>  >  I am sure the subject line wasn't too explanatory and so here goes.
>  >
>  >  I have a system which already has a Vec object created and distributed
on
>  >  many processors based on domain decomposition. I could have several
such
>  >  systems, each with a solution vector and a residual vector pertaining
to
>  its
>  >  physics.
>  >
>  >  Now, can I create a global vector which would just be pointers to the
>  >  already existing vectors but from PETSc's point of view, appears to be
a
>  >  globally valid, (and possibly weirdly) distributed vector. Such an
option
>  >  will save the memory needed for the global vector and eliminates
errors
>  as
>  >  to synchronization of the solution, residuals for the systems.
>
>  I do not understand what you want. If you want a vector with the same
>  layout,
>  use VecDuplicate(). If you want the same data, just use the Vec itself.
>
>   Thanks,
>
>     Matt
>
>  >  I was reading the documentation and found the PetscMap data structure.
>  But I
>  >  am not entirely sure if this is what I am looking for.
>  >
>  >  I hope that makes sense. I would appreciate any help you can provide
to
>  >  point me in the right direction.
>  >
>  >  Cheers,
>  >  Vijay
>  >
>  >  No virus found in this outgoing message.
>  >  Checked by AVG.
>  >  Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date:
>  3/22/2008
>  >  4:43 PM
>  >
>  >
>  >
>
>
>
>  --
>  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
>
>  No virus found in this incoming message.
>
>
> Checked by AVG.
>  Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date:
3/22/2008
>  4:43 PM
>
>
>  No virus found in this outgoing message.
>  Checked by AVG.
>  Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date:
3/22/2008
>  4:43 PM
>
>
>



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

No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date: 3/22/2008
4:43 PM
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date: 3/22/2008
4:43 PM
 




More information about the petsc-users mailing list