Hi John,
I assume you mean "opt" mode, otherwise that doesn't make sense because the
> error you are referring to above is an assert, which is only active in
> debug mode.
Yes, this doesn't make sense to me either. I'm running in "opt" mode, but
this assert still gets triggered.
I have pasted a very simple code below which causes the assert fail on my
machine. Could you please check if it fails for you too?
#include "libmesh.h"
#include "petsc_vector.h"
using namespace libMesh;
int main(int argc, char* argv[])
{
LibMeshInit libmesh_init(argc, argv);
Parallel::Communicator comm;
libmesh_init.comm().duplicate(comm);
int num_procs = comm.size();
int rank = comm.rank();
unsigned int N = 60;
unsigned int n = 60/num_procs;
std::vector<unsigned int> send_list(2);
if(num_procs != 1)
{
if(rank != 0)
send_list[0] = rank*n-1;
else
send_list[0] = n+2;
if(rank != num_procs - 1)
send_list[1] = (rank+1)*n+1;
else
send_list[1] = rank*n-2;
}
else
{
send_list[0] = 0;
send_list[1] = N-1;
}
PetscVector<double> parallel(comm, N, n, PARALLEL);
PetscVector<double> *ghosted = NULL;
if(num_procs != 1)
ghosted = new PetscVector<double>(comm, N, n+2, send_list, GHOSTED);
else
ghosted = new PetscVector<double>(comm, N, n, send_list, GHOSTED);
parallel.localize(*ghosted, send_list);
double a = (*ghosted)(send_list[0]);
double b = (*ghosted)(send_list[1]);
delete ghosted;
}
Thanks!
Harshad
On Tue, Mar 8, 2016 at 2:07 PM, John Peterson <[email protected]> wrote:
>
>
> On Tue, Mar 8, 2016 at 11:35 AM, Harshad Sahasrabudhe <[email protected]
> > wrote:
>
>> Hi,
>>
>> I'm running into a problem with ghost vectors created with PetscVector in
>> LibMesh 0.9.5 PETSc 3.5.4. When I call the operator(), the call fails at
>> the assert local_index < _local_size (petsc_vector.h:1214). The
>> _local_size
>> variable in PetscVector is 0 (after _get_array is called) even if the
>> *ghost
>> *indices vector is non-zero while creating the vector using the
>> constructor:
>>
>> PetscVector (const Parallel::Communicator &comm_in, const
>> numeric_index_type N, const numeric_index_type n_local, const std::vector<
>> numeric_index_type > &*ghost*, const ParallelType type=AUTOMATIC)
>>
>> I checked that the ghost indices are out of the scope of first_local_dof
>> and last_local_dof in DofMap. I am localizing the vector using the
>> function
>>
>> system->solution->localize(ghost_vector, ghost_indices)
>>
>> I don't get any error when I run in debug mode.
>
>
> I assume you mean "opt" mode, otherwise that doesn't make sense because
> the error you are referring to above is an assert, which is only active in
> debug mode.
>
>
>> Could this be a compilation
>> issue? I have no clue what this could be. Any help is appreciated!
>>
>
> I think it's more likely that your application code is doing something
> incorrectly...
>
> --
> John
>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users