[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Some questions about the parallel implementation of PETSc
- To: petsc-users@xxxxxxxxxxx
- Subject: Some questions about the parallel implementation of PETSc
- From: "Ben Tay" <zonexo@xxxxxxxxx>
- Date: Sat, 13 Jan 2007 10:46:06 +0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=K8HoPTUJGMMBs0FKwigBiaUWqbEp4s0ySo1fz3/bNK2Q89YagoQsmxwcVe06OFk6/v2FBcg27ir0wYmdikSsOr42ABBXo2DAAtEriLrWzLn0n59kmNfOyKBcggGCRoTymv2wejyLU+ZmtEzOl/4M9dorZ3fZ908Yywm6Ymp68zs=
- Reply-to: petsc-users@xxxxxxxxxxx
- Sender: owner-petsc-users@xxxxxxxxxxx
Hi,
I've the sequential version of PETSc working and I have some questions about the parallel implementation.
My code is to solve the NS eqn. Mainly it has to solve 2 linear eqns - momentum & poisson. The poisson eqn solving takes the most % of time so it going to be solved in parallel. Most likely the momentum eqn 'll be as well. The other parts of the code may be parallelized later using MPI.
The parallel part is coded as follows:
call MatCreate(PETSC_COMM_WORLD,A,ierr)
call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,m*n,m*n,ierr)
call MatSetFromOptions(A,ierr)
call MatGetOwnershipRange(A,Istart,Iend,ierr)
call VecCreateMPI(PETSC_COMM_WORLD,PETSC_DECIDE,m*n,b,ierr)
call VecSetFromOptions(b,ierr)
call VecDuplicate(b,x,ierr)
... insert matrix in parallel making use of Istart,Iend.
... assembly
... solve
Since I've used PETSC_DECIDE, PETSc will determine the local dimension of A and b and x automatically.
Is the no. of rows of A and b and x (Iend-Istart+1) locally?
After the eqn is solved, I need to obtain the answer x
I've used:
call VecGetArray(x,ppv,i_vec,ierr)
do j=1,size_y
do i=1,size_x
k=(j-1)*size_x+i
p(i,j)=ppv(k+i_vec)
end do
end do
call VecRestoreArray(x,ppv,i_vec,ierr)
I'm trying to get the address of the 1st value of x and map the values onto a rectangular grid to update p. Is this correct?
Or am I only able to get the local value, as in the local value of x. Do I need to use some MPI routines if I need to update the p values on the whole global grid?
thanks alot!