Francesco Migliorini <[email protected]> writes:

> Hello!
>
> I have an MPI code in which a linear system is created and solved with
> PETSc. It works in sequential run but when I use multiple cores the
> VecAssemblyBegin/End give segmentation fault. Here's a sample of my code:
>
> call PetscInitialize(PETSC_NULL_CHARACTER,perr)
>
>       ind(1) = 3*nnod_loc*max_time_deg
>       call VecCreate(PETSC_COMM_WORLD,feP,perr)
>       call VecSetSizes(feP,PETSC_DECIDE,ind,perr)

You set the global size here (does "nnod_loc" mean local? and is it the
same size on every process?), but then set values for all of these
below.

>       call VecSetFromOptions(feP,perr)
>
>       do in = nnod_loc
> do jt = 1,mm

What is mm?

> ind(1) = 3*((in -1)*max_time_deg + (jt-1))
> fval(1) = fe(3*((in -1)*max_time_deg + (jt-1)) +1)
> call VecSetValues(feP,1,ind,fval(1),INSERT_VALUES,perr)
> ind(1) = 3*((in -1)*max_time_deg + (jt-1)) +1
> fval(1) = fe(3*((in -1)*max_time_deg + (jt-1)) +2)
> call VecSetValues(feP,1,ind,fval(1),INSERT_VALUES,perr)
> ind(1) = 3*((in -1)*max_time_deg + (jt-1)) +2
> fval(1) = fe(3*((in -1)*max_time_deg + (jt-1)) +3)
> call VecSetValues(feP,1,ind,fval(1),INSERT_VALUES,perr)
>  enddo
>          enddo
>       enddo
>       call VecAssemblyBegin(feP,perr)
>       call VecAssemblyEnd(feP,perr)
>
> The vector has 640.000 elements more or less but I am running on a high
> performing computer so there shouldn't be memory issues. Does anyone know
> where is the problem and how can I fix it?
>
> Thank you,
> Francesco Migliorini

Attachment: signature.asc
Description: PGP signature

Reply via email to