DM and HDF5 Viewer
Hi again, I am now trying to write a vector to an HDF5, this time using a DM structure to impose the vector layout. Creating the vector with (as in src/dm/examples/tutorials/ex10.c) DMCreateGlobalVector(da2D,&gauss); every works fine, i.e. the hdf5 file has the correct layout given by the dimension of the DM. On the other side, if I use: VecCreate(PETSC_COMM_WORLD,&gauss); VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny); VecSetDM(gauss,da2D); VecSetFromOptions(gauss); VecSetUp(gauss); the hdf5 file contains a single dimension vector, apparently negecting the VecSetDM instruction (I would need this for vectors created by MatCreateVecs, in order to have both right and left vectors available). I did some testing but I did not manage to solve this. Is there anything I am doing wrong, or is this the way it is supposer to work? Thanks as always for your help, Gianluca
Gianluca Meneghello <[email protected]> writes:
Hi again,
I am now trying to write a vector to an HDF5, this time using a DM structure to impose the vector layout.
Creating the vector with (as in src/dm/examples/tutorials/ex10.c)
DMCreateGlobalVector(da2D,&gauss);
every works fine, i.e. the hdf5 file has the correct layout given by the dimension of the DM. On the other side, if I use:
VecCreate(PETSC_COMM_WORLD,&gauss); VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny); VecSetDM(gauss,da2D);
VecSetDM only associates a DM with the Vec. It does not interpose itself into VecView. Should we change this so that creating a Vec of the correct size/block size/layout and associating a DM is equivalent? Perhaps, but it's more nuanced than it might seem. Why don't you want to just call DMCreateGlobalVector()?
I need both right and left vectors for use in a SLEPc SVD decomposition; it is my understanding that the correct layout is obtained with MatCreateVecs and that only the layout for the right vector is created with DMCreateGlobalVector. Or I might be wrong and there is actually no difference! If so I will use DMCreateGlobalVector without any problem Thanks Gianluca On Thu, Jul 16, 2015 at 9:14 AM, Jed Brown <[email protected]> wrote:
Gianluca Meneghello <[email protected]> writes:
Hi again,
I am now trying to write a vector to an HDF5, this time using a DM structure to impose the vector layout.
Creating the vector with (as in src/dm/examples/tutorials/ex10.c)
DMCreateGlobalVector(da2D,&gauss);
every works fine, i.e. the hdf5 file has the correct layout given by the dimension of the DM. On the other side, if I use:
VecCreate(PETSC_COMM_WORLD,&gauss); VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny); VecSetDM(gauss,da2D);
VecSetDM only associates a DM with the Vec. It does not interpose itself into VecView.
Should we change this so that creating a Vec of the correct size/block size/layout and associating a DM is equivalent? Perhaps, but it's more nuanced than it might seem.
Why don't you want to just call DMCreateGlobalVector()?
Gianluca Meneghello <[email protected]> writes:
I need both right and left vectors for use in a SLEPc SVD decomposition; it is my understanding that the correct layout is obtained with MatCreateVecs and that only the layout for the right vector is created with DMCreateGlobalVector.
Do you have a non-square matrix? If so, is the left vector associated with a different DM?
Or I might be wrong and there is actually no difference! If so I will use DMCreateGlobalVector without any problem
If the system is square, DMCreateGlobalVector should be correct.
It is square. If so, I will use DMCreateGlobalVector. Thanks! Gianluca On Thu, Jul 16, 2015 at 9:25 AM, Jed Brown <[email protected]> wrote:
Gianluca Meneghello <[email protected]> writes:
I need both right and left vectors for use in a SLEPc SVD decomposition; it is my understanding that the correct layout is obtained with MatCreateVecs and that only the layout for the right vector is created with DMCreateGlobalVector.
Do you have a non-square matrix? If so, is the left vector associated with a different DM?
Or I might be wrong and there is actually no difference! If so I will use DMCreateGlobalVector without any problem
If the system is square, DMCreateGlobalVector should be correct.
On Jul 16, 2015, at 11:14 AM, Jed Brown <[email protected]> wrote:
Gianluca Meneghello <[email protected]> writes:
Hi again,
I am now trying to write a vector to an HDF5, this time using a DM structure to impose the vector layout.
Creating the vector with (as in src/dm/examples/tutorials/ex10.c)
DMCreateGlobalVector(da2D,&gauss);
every works fine, i.e. the hdf5 file has the correct layout given by the dimension of the DM. On the other side, if I use:
VecCreate(PETSC_COMM_WORLD,&gauss); VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny); VecSetDM(gauss,da2D);
VecSetDM only associates a DM with the Vec. It does not interpose itself into VecView.
Should we change this so that creating a Vec of the correct size/block size/layout and associating a DM is equivalent? Perhaps, but it's more nuanced than it might seem.
Yikes. VecSetDM() seems a very dangerous and odd thing. Should it exist? If it exists it seems it should be exactly equivalent to creating the vector from the DM.
Why don't you want to just call DMCreateGlobalVector()?
On Thu, Jul 16, 2015 at 1:31 PM, Barry Smith <[email protected]> wrote:
On Jul 16, 2015, at 11:14 AM, Jed Brown <[email protected]> wrote:
Gianluca Meneghello <[email protected]> writes:
Hi again,
I am now trying to write a vector to an HDF5, this time using a DM structure to impose the vector layout.
Creating the vector with (as in src/dm/examples/tutorials/ex10.c)
DMCreateGlobalVector(da2D,&gauss);
every works fine, i.e. the hdf5 file has the correct layout given by the dimension of the DM. On the other side, if I use:
VecCreate(PETSC_COMM_WORLD,&gauss); VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny); VecSetDM(gauss,da2D);
VecSetDM only associates a DM with the Vec. It does not interpose itself into VecView.
Should we change this so that creating a Vec of the correct size/block size/layout and associating a DM is equivalent? Perhaps, but it's more nuanced than it might seem.
Yikes. VecSetDM() seems a very dangerous and odd thing. Should it exist? If it exists it seems it should be exactly equivalent to creating the vector from the DM.
I tend to disagree. It is used to set a member variable which is not exposed: find src -name "*.c" | xargs grep VecSetDM src/dm/impls/composite/pack.c: ierr = VecSetDM(*gvec, dm);CHKERRQ(ierr); src/dm/impls/composite/pack.c: ierr = VecSetDM(*lvec, dm);CHKERRQ(ierr); src/dm/impls/da/dadist.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr); src/dm/impls/da/dalocal.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr); src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr); src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr); src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*lvec,dm);CHKERRQ(ierr); src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/sliced/sliced.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr); src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr); src/dm/interface/ftn-auto/dmf.c:*__ierr = VecSetDM( I don't like putting in a bunch of side-effects. Those come from actually being created from a DM, which is correct. Matt
Why don't you want to just call DMCreateGlobalVector()?
-- 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
Then the documentation needs to make it very clear what it does (which is not much) and how it is VERY different than getting the vector from the DM.
On Jul 16, 2015, at 1:35 PM, Matthew Knepley <[email protected]> wrote:
On Thu, Jul 16, 2015 at 1:31 PM, Barry Smith <[email protected]> wrote:
On Jul 16, 2015, at 11:14 AM, Jed Brown <[email protected]> wrote:
Gianluca Meneghello <[email protected]> writes:
Hi again,
I am now trying to write a vector to an HDF5, this time using a DM structure to impose the vector layout.
Creating the vector with (as in src/dm/examples/tutorials/ex10.c)
DMCreateGlobalVector(da2D,&gauss);
every works fine, i.e. the hdf5 file has the correct layout given by the dimension of the DM. On the other side, if I use:
VecCreate(PETSC_COMM_WORLD,&gauss); VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny); VecSetDM(gauss,da2D);
VecSetDM only associates a DM with the Vec. It does not interpose itself into VecView.
Should we change this so that creating a Vec of the correct size/block size/layout and associating a DM is equivalent? Perhaps, but it's more nuanced than it might seem.
Yikes. VecSetDM() seems a very dangerous and odd thing. Should it exist? If it exists it seems it should be exactly equivalent to creating the vector from the DM.
I tend to disagree. It is used to set a member variable which is not exposed:
find src -name "*.c" | xargs grep VecSetDM src/dm/impls/composite/pack.c: ierr = VecSetDM(*gvec, dm);CHKERRQ(ierr); src/dm/impls/composite/pack.c: ierr = VecSetDM(*lvec, dm);CHKERRQ(ierr); src/dm/impls/da/dadist.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr); src/dm/impls/da/dalocal.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr); src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr); src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr); src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*lvec,dm);CHKERRQ(ierr); src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/sliced/sliced.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr); src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr); src/dm/interface/ftn-auto/dmf.c:*__ierr = VecSetDM(
I don't like putting in a bunch of side-effects. Those come from actually being created from a DM, which is correct.
Matt
Why don't you want to just call DMCreateGlobalVector()?
-- 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
Pushed Matt On Thu, Jul 16, 2015 at 1:51 PM, Barry Smith <[email protected]> wrote:
Then the documentation needs to make it very clear what it does (which is not much) and how it is VERY different than getting the vector from the DM.
On Jul 16, 2015, at 1:35 PM, Matthew Knepley <[email protected]> wrote:
On Thu, Jul 16, 2015 at 1:31 PM, Barry Smith <[email protected]> wrote:
On Jul 16, 2015, at 11:14 AM, Jed Brown <[email protected]> wrote:
Gianluca Meneghello <[email protected]> writes:
Hi again,
I am now trying to write a vector to an HDF5, this time using a DM structure to impose the vector layout.
Creating the vector with (as in src/dm/examples/tutorials/ex10.c)
DMCreateGlobalVector(da2D,&gauss);
every works fine, i.e. the hdf5 file has the correct layout given by the dimension of the DM. On the other side, if I use:
VecCreate(PETSC_COMM_WORLD,&gauss); VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny); VecSetDM(gauss,da2D);
VecSetDM only associates a DM with the Vec. It does not interpose itself into VecView.
Should we change this so that creating a Vec of the correct size/block size/layout and associating a DM is equivalent? Perhaps, but it's more nuanced than it might seem.
Yikes. VecSetDM() seems a very dangerous and odd thing. Should it exist? If it exists it seems it should be exactly equivalent to creating the vector from the DM.
I tend to disagree. It is used to set a member variable which is not exposed:
find src -name "*.c" | xargs grep VecSetDM src/dm/impls/composite/pack.c: ierr = VecSetDM(*gvec, dm);CHKERRQ(ierr); src/dm/impls/composite/pack.c: ierr = VecSetDM(*lvec, dm);CHKERRQ(ierr); src/dm/impls/da/dadist.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr); src/dm/impls/da/dalocal.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr); src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr); src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr); src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*lvec,dm);CHKERRQ(ierr); src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/impls/sliced/sliced.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr); src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr); src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr); src/dm/interface/ftn-auto/dmf.c:*__ierr = VecSetDM(
I don't like putting in a bunch of side-effects. Those come from actually being created from a DM, which is correct.
Matt
Why don't you want to just call DMCreateGlobalVector()?
-- 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
-- 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
participants (4)
-
Barry Smith -
Gianluca Meneghello -
Jed Brown -
Matthew Knepley