problem of "caused collective abort of all ranks"
jiaxun hou
jiaxun_hou at yahoo.com.cn
Sun Aug 13 22:55:33 CDT 2006
Hi,
I am sorry to bother you. I met this strange trouble yesterday, and I have tried lots of methods to solve it. But fail. My code likes this:
static char help[] = "Solves a tridiagonal linear system with KSP.\n\n";
#include "petscksp.h"
#include "builderh.h"
#undef __FUNCT__
#define __FUNCT__ "main"
int main(int argc,char **args){
PetscInitialize(&argc,&args,(char *)0,help);
Mat A;
Vec x;
PetscInt k=3,v=1,n_x=5,s_t=4,row;
PetscInt i[2];
PetscReal h_x,h_t;
PetscScalar temp;
MainMatPar *mmp;
PetscErrorCode ierr;
h_x = PETSC_PI/(PetscReal)(n_x+1);
h_t = PETSC_PI*2/(PetscReal)(s_t);
s_t++;
ierr = VecCreate(PETSC_COMM_WORLD,&x);CHKERRQ(ierr);
ierr = PetscObjectSetName((PetscObject) x, "Solution");CHKERRQ(ierr);
ierr = VecSetSizes(x,PETSC_DECIDE,n_x*s_t);CHKERRQ(ierr);
ierr = VecSetFromOptions(x);CHKERRQ(ierr);
temp = h_x;
for (i[0]=0;i[0]<n_x*s_t;i[0]++) {
row=i[0];
ierr = VecSetValues(x,1,&row,&temp,INSERT_VALUES);CHKERRQ(ierr);
temp+=h_x;
}
ierr = VecAssemblyBegin(x);CHKERRQ(ierr);
ierr = VecAssemblyEnd(x);CHKERRQ(ierr);
ierr = VecSet(x,0);CHKERRQ(ierr);
ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
/**/
ierr = CreateMainMatPar(RC_1,k,v,n_x,s_t,h_x,h_t,&mmp);CHKERRQ(ierr);
ierr = BuildMainMatrix(&A,mmp); CHKERRQ(ierr);
ierr = DestroyMainMatPar(mmp);CHKERRQ(ierr);
//ierr = MatView(A,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
ierr = MatDestroy(A);CHKERRQ(ierr);
ierr = VecDestroy(x);CHKERRQ(ierr);
ierr = PetscFinalize();CHKERRQ(ierr);
return 0;
}
When I delete the line "ierr = VecSet(x,0);CHKERRQ(ierr);" , the problem occurs. I don't know why.
I attach the two files that were used in the above code.
And my run it in one process.
Regards,
Jiaxun
---------------------------------
雅虎免费邮箱-3.5G容量,20M附件
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20060814/cdffd105/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: builderh.h
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20060814/cdffd105/attachment.diff>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: builder.c
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20060814/cdffd105/attachment-0001.diff>
More information about the petsc-users
mailing list