[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Conversion matrix from Ellpack-Itpack to CSR to PETSc format
- To: petsc-users@xxxxxxxxxxx
- Subject: Conversion matrix from Ellpack-Itpack to CSR to PETSc format
- From: Ben Tay <zonexo@xxxxxxxxx>
- Date: Thu, 09 Aug 2007 11:00:23 +0800
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=ptJk0ihZtZLkQDSlqKuXXLMi4e03TbuUPdPjagbkJjy7yiFSZuDRLKvwrpeVHMcBNezutfI2ojyjG8yJTkLKOYudm5KwPxw9XQFGC7OoiNkpd3pRRrmYdOEpJqXf2A6EsMGiH2OomMETnfDGPY/R0ahkxb2+h02mlSpreortLPQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=Rl2baA1HrLKyeQkUlSH6lwG4A1x6g0AcQyJ0V5edbicdlMNgu2ygtYsTMTDNLhFpZ7cGgvfm0RzUxOqNbS9biRzoff6seGjen0/GJIaZO4EirvfZTE06PWBZ//aNqsTymlCgLvQN1GQsvPtSLPcoQL5K3jOGbBkPyS125MTuRtA=
- Reply-to: petsc-users@xxxxxxxxxxx
- Sender: owner-petsc-users@xxxxxxxxxxx
- User-agent: Thunderbird 2.0.0.6 (Windows/20070728)
Hi,
My original matrix is stored in Ellpack-Itpack format, which is used by
the NSPCG solver. I have problems when I insert the values of the matrix
into a PETSc matrix. I guessed I made some mistakes but I can't find
where during debugging. So I intent to just convert from the
Ellpack-Itpack to CSR using a subroutine by SPARSKIT2 called ellcsr.
Then I use MatCreateSeqAIJWithArrays to get my PETSc matrix.
I'm programming in fortran so index starts from 1. I tried to shift the
row and column index by -1. The 1st step works but there's error when
solving at the 2nd time step. The error is:
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
probably m
emory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see
http://www.mcs.anl.gov/petsc/petsc-as/documentation/troub
leshooting.html#Signal[0]PETSC ERROR: or try http://valgrind.org on
linux or man
libgmalloc on Apple to find memory corruption errors
[0]PETSC ERROR: likely location of problem given in stack below
[0]PETSC ERROR: --------------------- Stack Frames
----------------------------
--------
[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
[0]PETSC ERROR: INSTEAD the line number of the start of the function
[0]PETSC ERROR: is given.
My subroutine is as follows:
Note that A_mat is declared as global variable.
if (time==1) then
call
ellcsr(total_k,big_A,int_a,total_k,9,A_spar,ja_spar,ia_spar,nzmax,ierr)
- convert big_A,int_A in Ellpack-Itpack format to CSR using ellcsr
ia_spar=ia_spar-1; ja_spar=ja_spar-1 - shift by -1
call
MatCreateSeqAIJWithArrays(PETSC_COMM_SELF,Ntot,13,ia_spar,ja_spar,A_spar,A_mat_spar,ierr)
call MatAssemblyBegin(A_mat,MAT_FINAL_ASSEMBLY,ierr)
call MatAssemblyEnd(A_mat,MAT_FINAL_ASSEMBLY,ierr)
end if
...
I thought I would only need to do this once since the A_mat does not
change and it is declared globally. If I remove the "IF - END IF" and
execute at every time step, everything will be fine. But I thought that
will be very inefficient. So how should I solve the problem?
Thanks