Great ! it worked, im carrying out tests, Btw, any of you developers and users are attending SC16 next week ? i will be there as a volunteer and a big group from CSRC-SDSU also, we would like to share some thoughts,
Regards and many thanks, Manuel On Fri, Nov 4, 2016 at 8:19 PM, Matthew Knepley <[email protected]> wrote: > On Fri, Nov 4, 2016 at 7:37 PM, Manuel Valera <[email protected]> > wrote: > >> Hello all, >> >> I'm reviving this old post because we are trying to share the petsc >> objects from outside our iteration routine, this means several levels >> outside the linear solver script where they are created now, >> >> we have tried with fortran modules but right now we have conflicts while >> taking the includes, if we make the #include in the module it conflicts >> with the rest of the routines, so we wanted to ask you guys what other >> option to make the petsc objects available for the entire program we have, >> carrying them as arguments seems maybe too cumbersome, >> > > Use the Fortran modules > > http://www.mcs.anl.gov/petsc/petsc-current/docs/ > manualpages/Sys/UsingFortran.html > > although I would delicately recommend a language with a non-broken scoping > model. > > Matt > > >> Thanks for your help, >> >> Manuel >> >> >> >> On Fri, Sep 23, 2016 at 12:39 PM, Barry Smith <[email protected]> wrote: >> >>> >>> I don't know much about modules so can't help, but PETSc variables >>> are just like any other variables and so should behave in the same way. >>> >>> Barry >>> >>> > On Sep 23, 2016, at 2:31 PM, Manuel Valera <[email protected]> >>> wrote: >>> > >>> > Ok, i got this: >>> > >>> > RHS loaded, size: 213120 / 213120 >>> > CSRMAt loaded, sizes: 213120 x 213120 >>> > 8.43036175 s >>> > solveP pass: 1 >>> > RHS loaded, size: 213120 / 213120 >>> > [0]PETSC ERROR: MatGetSize() line 6295 in >>> /home/valera/v5PETSc/petsc/petsc/src/mat/interface/matrix.c Wrong type >>> of object: Parameter # 1 >>> > >>> > Program received signal SIGABRT: Process abort signal. >>> > >>> > Backtrace for this error: >>> > #0 0x7F2A35AEA777 >>> > #1 0x7F2A35AEAD7E >>> > #2 0x7F2A34FC6CAF >>> > #3 0x7F2A34FC6C37 >>> > #4 0x7F2A34FCA027 >>> > #5 0x7F2A35F6F6AA >>> > #6 0x7F2A35F6A2EA >>> > #7 0x7F2A362E2FEF >>> > #8 0x7F2A36326681 >>> > #9 0x799AFF in solvepetsclinear_ at SolvePetscLinear.f90:137 >>> (discriminator 2) >>> > #10 0x798F6A in solvep_rhs_ at SolveP_Rhs.f90:284 >>> > #11 0x80D028 in ucmsmain at ucmsMain.f90:472 >>> > >>> > .-.-.-.-.-.-.-.- >>> > >>> > What is weird for me is why it loads everything as it should for the >>> first timestep of the problem and then it breaks on the second one, >>> shouldnt the matrix be loaded at modules and shared with all subroutines? >>> also, shouldnt the matrix be locked after assembly_final was used ? that >>> matrix call is Ap which is inside LoadPetscMatrix module, and it looks like >>> its changed after the first timestep. >>> > >>> > >>> > On Fri, Sep 23, 2016 at 12:18 PM, Barry Smith <[email protected]> >>> wrote: >>> > >>> > Ok, so the problem is not memory corruption. >>> > >>> > > 0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > [0]PETSC ERROR: Invalid argument >>> > > [0]PETSC ERROR: Wrong type of object: Parameter # 1 >>> > > [0]PETSC ERROR: #1 MatGetSize() line 6295 in >>> /home/valera/v5PETSc/petsc/petsc/src/mat/interface/matrix.c >>> > >>> > So it looks like the matrix has not been created yet in this call. >>> You can run with -start_in_debugger noxterm and then type cont in the >>> debugger and it should stop at this error so you can look at the mat object >>> to see what its value is. >>> > >>> > Barry >>> > >>> > >>> > >>> > > On Sep 23, 2016, at 2:07 PM, Manuel Valera <[email protected]> >>> wrote: >>> > > >>> > > Barry, that was awesome, all the valgrind error dissappeared after >>> using the mpiexec from petsc folder, the more you know... >>> > > >>> > > Anyway this is my output from valgrind running with those options: >>> > > >>> > > Last Update: 9/23/2016 12: 5:12 >>> > > ucmsSeamount Entering MAIN loop. >>> > > RHS loaded, size: 213120 / 213120 >>> > > CSRMAt loaded, sizes: 213120 x 213120 >>> > > 8.32709217 s >>> > > solveP pass: 1 >>> > > RHS loaded, size: 213120 / 213120 >>> > > CSRMAt loaded, sizes: 213120 x 0 >>> > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > [0]PETSC ERROR: Invalid argument >>> > > [0]PETSC ERROR: Wrong type of object: Parameter # 1 >>> > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 12:05:03 2016 >>> > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > [0]PETSC ERROR: #1 MatGetSize() line 6295 in >>> /home/valera/v5PETSc/petsc/petsc/src/mat/interface/matrix.c >>> > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > [0]PETSC ERROR: Invalid argument >>> > > [0]PETSC ERROR: Wrong type of object: Parameter # 2 >>> > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 12:05:03 2016 >>> > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > [0]PETSC ERROR: #2 KSPSetOperators() line 531 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/ksp/interface/itcreate.c >>> > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > [0]PETSC ERROR: Nonconforming object sizes >>> > > [0]PETSC ERROR: Preconditioner number of local rows -1 does not >>> equal resulting vector number of rows 213120 >>> > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 12:05:03 2016 >>> > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > [0]PETSC ERROR: #3 PCApply() line 474 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/pc/interface/precon.c >>> > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > [0]PETSC ERROR: Object is in wrong state >>> > > [0]PETSC ERROR: Mat object's type is not set: Argument # 1 >>> > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 12:05:03 2016 >>> > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > [0]PETSC ERROR: #4 MatGetFactorAvailable() line 4286 in >>> /home/valera/v5PETSc/petsc/petsc/src/mat/interface/matrix.c >>> > > [0]PETSC ERROR: #5 PCGetDefaultType_Private() line 28 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/pc/interface/precon.c >>> > > [0]PETSC ERROR: #6 PCSetFromOptions() line 159 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/pc/interface/pcset.c >>> > > [0]PETSC ERROR: #7 KSPSetFromOptions() line 400 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/ksp/interface/itcl.c >>> > > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0 >>> > > [cli_0]: aborting job: >>> > > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0 >>> > > >>> > > ============================================================ >>> ======================= >>> > > = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES >>> > > = PID 6490 RUNNING AT valera-HP-xw4600-Workstation >>> > > = EXIT CODE: 73 >>> > > = CLEANING UP REMAINING PROCESSES >>> > > = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES >>> > > ============================================================ >>> ======================= >>> > > ==6488== >>> > > ==6488== HEAP SUMMARY: >>> > > ==6488== in use at exit: 131,120 bytes in 2 blocks >>> > > ==6488== total heap usage: 1,224 allocs, 1,222 frees, 249,285 >>> bytes allocated >>> > > ==6488== >>> > > ==6488== LEAK SUMMARY: >>> > > ==6488== definitely lost: 0 bytes in 0 blocks >>> > > ==6488== indirectly lost: 0 bytes in 0 blocks >>> > > ==6488== possibly lost: 0 bytes in 0 blocks >>> > > ==6488== still reachable: 131,120 bytes in 2 blocks >>> > > ==6488== suppressed: 0 bytes in 0 blocks >>> > > ==6488== Rerun with --leak-check=full to see details of leaked memory >>> > > ==6488== >>> > > ==6488== For counts of detected and suppressed errors, rerun with: -v >>> > > ==6488== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from >>> 0) >>> > > >>> > > >>> > > On Fri, Sep 23, 2016 at 11:15 AM, Barry Smith <[email protected]> >>> wrote: >>> > > >>> > > > On Sep 23, 2016, at 1:09 PM, Manuel Valera <[email protected]> >>> wrote: >>> > > > >>> > > > Thanks Barry, for the quick reply, >>> > > > >>> > > > I tried doing that once recently, not for this problem though, but >>> it looks like the model i'm working on isn't optimized at all for memory >>> leaks, and valgrind stopped with thousands of errors before reaching this >>> part of the execution. >>> > > >>> > > Some MPI implementations by default produce many meaningless >>> valgrind messages. So make sure you ./configure PETSc with --download-mpich >>> this version will not produce any meaningless valgrind messages about MPI. >>> > > >>> > > You are not concerned with "memory leaks" in this exercise, only >>> with using uninitialized memory or overwriting memory you should not >>> overwrite. So you want valgrind arguments like -q --tool=memcheck >>> --num-callers=20 --track-origins=yes you do not need --leak-check=yes >>> > > >>> > > So run with valgrind and email use the output and we may have >>> suggestions on the cause. >>> > > >>> > > Barry >>> > > >>> > > >>> > > >>> > > > >>> > > > Is there maybe an alternative approach ? or it would be better to >>> just get the model in better shape already ? >>> > > > >>> > > > Thanks >>> > > > >>> > > > On Fri, Sep 23, 2016 at 10:53 AM, Barry Smith <[email protected]> >>> wrote: >>> > > > >>> > > > Run with valgrind to find the exact location of the first memory >>> corruption. http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind >>> > > > >>> > > > > On Sep 23, 2016, at 12:47 PM, Manuel Valera < >>> [email protected]> wrote: >>> > > > > >>> > > > > Hello all, >>> > > > > >>> > > > > I'm trying to load my laplacian matrix into a fortran module, >>> and i have implemented it and it works for the first iteration of laplacian >>> solver, but when starts the second step the laplacian matrix object becomes >>> corrupts and looks like it loses one of it's dimensions. >>> > > > > >>> > > > > Can you help me understand whats happening? >>> > > > > >>> > > > > The modules are attached, the error i get is the following, i >>> bolded the lines where i detected corruption: >>> > > > > >>> > > > > ucmsSeamount Entering MAIN loop. >>> > > > > RHS loaded, size: 213120 / 213120 >>> > > > > CSRMAt loaded, sizes: 213120 x 213120 >>> > > > > 8.39198399 s >>> > > > > solveP pass: 1 !Iteration number >>> > > > > RHS loaded, size: 213120 / 213120 >>> > > > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > > > [0]PETSC ERROR: Invalid argument >>> > > > > [0]PETSC ERROR: Wrong type of object: Parameter # 1 >>> > > > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 10:27:21 2016 >>> > > > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > > > [0]PETSC ERROR: #1 MatGetSize() line 6295 in >>> /home/valera/v5PETSc/petsc/petsc/src/mat/interface/matrix.c >>> > > > > CSRMAt loaded, sizes: 213120 x 0 >>> > > > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > > > [0]PETSC ERROR: Invalid argument >>> > > > > [0]PETSC ERROR: Wrong type of object: Parameter # 2 >>> > > > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 10:27:21 2016 >>> > > > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > > > [0]PETSC ERROR: #2 KSPSetOperators() line 531 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/ksp/interface/itcreate.c >>> > > > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > > > [0]PETSC ERROR: Nonconforming object sizes >>> > > > > [0]PETSC ERROR: Preconditioner number of local rows -1 does not >>> equal resulting vector number of rows 213120 >>> > > > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 10:27:21 2016 >>> > > > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > > > [0]PETSC ERROR: #3 PCApply() line 474 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/pc/interface/precon.c >>> > > > > [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> > > > > [0]PETSC ERROR: Object is in wrong state >>> > > > > [0]PETSC ERROR: Mat object's type is not set: Argument # 1 >>> > > > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/d >>> ocumentation/faq.html for trouble shooting. >>> > > > > [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown >>> > > > > [0]PETSC ERROR: ./ucmsSeamount >>> >>> >>> �J� on a >>> arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep 23 >>> 10:27:21 2016 >>> > > > > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 >>> --download-ml=1 >>> > > > > [0]PETSC ERROR: #4 MatGetFactorAvailable() line 4286 in >>> /home/valera/v5PETSc/petsc/petsc/src/mat/interface/matrix.c >>> > > > > [0]PETSC ERROR: #5 PCGetDefaultType_Private() line 28 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/pc/interface/precon.c >>> > > > > [0]PETSC ERROR: #6 PCSetFromOptions() line 159 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/pc/interface/pcset.c >>> > > > > [0]PETSC ERROR: #7 KSPSetFromOptions() line 400 in >>> /home/valera/v5PETSc/petsc/petsc/src/ksp/ksp/interface/itcl.c >>> > > > > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0 >>> > > > > [unset]: aborting job: >>> > > > > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0 >>> > > > > >>> > > > > <LoadPetscMatrix.f90><SolvePetscLinear.f90> >>> > > > >>> > > > >>> > > >>> > > >>> > >>> > >>> >>> >> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener >
