<div dir="ltr">Sure thank you.<br></div><br><div class="gmail_quote"><div class="gmail_attr" dir="ltr">On Thu, Apr 25, 2019 at 10:32 AM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><br>
Thanks for letting us know. The latest PETSc release automatically detects this issue at ./configure time. You might consider upgrading just to get the most stable software as we keep improving PETSc.<br>
<br>
Barry<br>
<br>
<br>
> On Apr 25, 2019, at 9:35 AM, Karl Lin <<a href="mailto:karl.linkui@gmail.com" target="_blank">karl.linkui@gmail.com</a>> wrote:<br>
> <br>
> Thanks for tip, I figured out the issue. I was linking to ilp64 instead of lp64.<br>
> <br>
> On Thu, Apr 25, 2019 at 12:34 AM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br>
> <br>
> I ran your problem fine on one process. no errors.<br>
> <br>
> Suggest you run under valgrind on your system: <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank" rel="noreferrer">https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a> or if that is not useful<br>
> <br>
> Run in the debugger with the option -start_in_debugger noxterm<br>
> <br>
> Good luck,<br>
> <br>
> Barry<br>
> <br>
> <br>
> <br>
> > On Apr 24, 2019, at 10:36 PM, Zhang, Junchao via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> > <br>
> > How many MPI ranks do you use? The following line is suspicious. I guess you do not want a vector of global length 1. <br>
> > 66 VecSetSizes(b,PETSC_DECIDE,1);<br>
> > <br>
> > --Junchao Zhang<br>
> > <br>
> > <br>
> > On Wed, Apr 24, 2019 at 4:14 PM Karl Lin via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> > Hi, there<br>
> > <br>
> > I have been trying to get a simple program run with the following code:<br>
> > <br>
> > 12 int main(int argc,char **args)<br>
> > 13 {<br>
> > 14 PetscErrorCode ierr;<br>
> > 15 Mat A;<br>
> > 16 Mat AT;<br>
> > 17 Mat N;<br>
> > 18 char name[1024];<br>
> > 19 char vname[1024];<br>
> > 20 char pass[1024];<br>
> > 21 PetscBool flg;<br>
> > 22 Vec b,x,u,Ab,Au;<br>
> > 23 PetscViewer viewer; /* viewer */<br>
> > 24 PetscMPIInt rank,size;<br>
> > 25<br>
> > 26 KSP QRsolver;<br>
> > 27 PC pc;<br>
> > 28 PetscInt its;<br>
> > 29 PetscReal norm;<br>
> > 30<br>
> > 31 PetscInt n1, n2, n3, np1, np2, np3, p, jj;<br>
> > 32<br>
> > 33 PetscInt *cols, *dnz, *onz;<br>
> > 34 PetscScalar *vals;<br>
> > 35<br>
> > 36 ierr = PetscInitialize(&argc,&args,0,help);if (ierr) return ierr;<br>
> > 37<br>
> > 38 ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr);<br>
> > 39 ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr);<br>
> > 40<br>
> > 41 PetscMalloc1(1, &dnz);<br>
> > 42 PetscMalloc1(1, &onz);<br>
> > 43<br>
> > 44 dnz[0]=2;<br>
> > 45 onz[0]=1;<br>
> > 46<br>
> > 47 MatCreateMPIAIJMKL(PETSC_COMM_WORLD, 1, 2, 1, 2, 2, dnz, 2, onz, &A); CHKERRQ(ierr);<br>
> > 48<br>
> > 49 PetscMalloc1(2, &cols);<br>
> > 50 PetscMalloc1(2, &vals);<br>
> > 51<br>
> > 52 jj = rank;<br>
> > 53 cols[0]=0; cols[1]=1;<br>
> > 54 vals[0]=1.0;vals[1]=1.0;<br>
> > 55<br>
> > 56 MatSetValues(A, 1, &jj, 2, cols, vals, INSERT_VALUES);<br>
> > 57<br>
> > 58 MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY);<br>
> > 59 MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY);<br>
> > 60<br>
> > 61 VecCreate(PETSC_COMM_WORLD,&x);<br>
> > 62 VecSetSizes(x,PETSC_DECIDE,2);<br>
> > 63 VecSetFromOptions(x);<br>
> > 64<br>
> > 65 VecCreate(PETSC_COMM_WORLD,&b);<br>
> > 66 VecSetSizes(b,PETSC_DECIDE,1);<br>
> > 67 VecSetFromOptions(b);<br>
> > 68<br>
> > 69 VecCreate(PETSC_COMM_WORLD,&u);<br>
> > 70 VecSetSizes(u,PETSC_DECIDE,1);<br>
> > 71 VecSetFromOptions(u);<br>
> > 72<br>
> > 73 VecSet(b, 2.0);<br>
> > 74 VecSet(u, 0.0);<br>
> > 75 VecSet(x, 0.0);<br>
> > 76<br>
> > 77 MatMult(A, x, u);<br>
> > 78<br>
> > 79 VecView(x, PETSC_VIEWER_STDOUT_WORLD);<br>
> > 80 VecView(b, PETSC_VIEWER_STDOUT_WORLD);<br>
> > 81 VecView(u, PETSC_VIEWER_STDOUT_WORLD);<br>
> > 82<br>
> > 83 VecAXPY(u,-1.0,b);<br>
> > <br>
> > However, it always crashes at line 83 even with single process saying:<br>
> > [0]PETSC ERROR: ------------------------------------------------------------------------<br>
> > [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range<br>
> > [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger<br>
> > [0]PETSC ERROR: or see <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank" rel="noreferrer">http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a><br>
> > [0]PETSC ERROR: or try <a href="http://valgrind.org" target="_blank" rel="noreferrer">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors<br>
> > [0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run<br>
> > [0]PETSC ERROR: to get more information on the crash.<br>
> > [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>
> > [0]PETSC ERROR: Signal received<br>
> > [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank" rel="noreferrer">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>
> > [0]PETSC ERROR: Petsc Release Version 3.10.4, Feb, 26, 2019<br>
> > <br>
> > I can't figure out why this would happen. The printout from VecView shows every vec value is correct. I will greatly appreciate any tips.<br>
> > <br>
> > Regards,<br>
> > Karl<br>
> > <br>
> <br>
<br>
</blockquote></div>