Hi  John,

I modified the initialization of y to


 UniquePtr< NumericVector< Number > >  x = 
es.get_system(system_name).solution->zero_clone();
 std::vector< dof_id_type > some_dofs( some_dof_set.begin(), some_dof_set.end() 
);
 PetscVector< Number > y( mesh.comm(), x->size(), some_dofs.size(), PARALLEL );
 x->create_subvector( y, some_dofs );


In this case, I get no segfault and the ouput is


PROC = 1: local size of some_dofs = 62
PROC = 1: global size of y = 121
PROC = 1: local size of y = 62
PROC = 1: (first,last) local index of y = (10, 72)
PROC = 0: local size of some_dofs = 10
PROC = 0: global size of y = 121
PROC = 0: local size of y = 10
PROC = 0: (first,last) local index of y = (0, 10)


which looks okay.


Jonas


________________________________
Von: John Peterson <jwpeter...@gmail.com>
Gesendet: Donnerstag, 14. Juli 2016 17:25
An: Jonas Ballani; libmesh-users
Betreff: Re: [Libmesh-users] Bug in PetscVector::create_subvector



On Thu, Jul 14, 2016 at 9:08 AM, Jonas Ballani 
<jonas.ball...@epfl.ch<mailto:jonas.ball...@epfl.ch>> wrote:

Hi John,


Thanks for your quick reply. If you don't initialize y, say by just calling


PetscVector< Number > y( mesh.comm() );


you get a memory leak.

[1]PETSC ERROR: --------------------- Error Message 
--------------------------------------------------------------
[1]PETSC ERROR: Petsc has generated inconsistent data
[1]PETSC ERROR: ith 28 block entry 36 not owned by any process, upper bound 36
[1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for 
trouble shooting.
[1]PETSC ERROR: Petsc Release Version 3.7.1, May, 15, 2016
[1]PETSC ERROR: ./example-opt on a arch-linux2-c-opt named iacspc13 by jballani 
Thu Jul 14 17:06:33 2016
[1]PETSC ERROR: Configure options --with-shared-libraries=1 --with-debugging=0 
--download-suitesparse --download-blacs --download-ptscotch=yes 
--download-scalapack --download-mumps --download-metis 
--prefix=/home/jballani/software/libmesh_install/opt_real/petsc 
--download-hypre --download-ml
[1]PETSC ERROR: #1 VecScatterCreate_PtoS() line 2348 in 
/home/jballani/software/petsc-3.7.1/src/vec/vec/utils/vpscat.c
[1]PETSC ERROR: #2 VecScatterCreate_StoP() line 2804 in 
/home/jballani/software/petsc-3.7.1/src/vec/vec/utils/vpscat.c
[1]PETSC ERROR: #3 VecScatterCreate_PtoP() line 2993 in 
/home/jballani/software/petsc-3.7.1/src/vec/vec/utils/vpscat.c
[1]PETSC ERROR: #4 VecScatterCreate() line 1656 in 
/home/jballani/software/petsc-3.7.1/src/vec/vec/utils/vscat.c

Looks more like a segfault, but yeah, that's not good.  Can you go back to your 
original line of code and tack on PARALLEL for the type?

PetscVector< Number > y( mesh.comm(), x->size(), PARALLEL );

I'm not sure what will happen in this case (creating a PARALLEL vector with 
n==n_local, seems like we should use PETSC_DECIDE there) but it might do the 
right thing.

--
John
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to