On Tue, Mar 8, 2016 at 12:12 PM, Harshad Sahasrabudhe <[email protected]>
wrote:
> 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;
> }
>
Hmm... I haven't verified this yet in detail, but you are possibly hitting
a relatively uncommon code path in
PetscVector<T>::localize(NumericVector<T> &, const
std::vector<numeric_index_type> &):
// FIXME: Workaround for a strange bug at large-scale.
// If we have ghosting, PETSc lets us just copy the solution, and
// doing so avoids a segfault?
if (v_local_in.type() == GHOSTED &&
this->type() == PARALLEL)
{
v_local_in = *this;
return;
}
Maybe this just isn't working quite right. If you, for example, change the
type of "ghosted" to PARALLEL, does it fix the problem?
--
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