<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 30, 2021 at 12:08 AM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><br></div>   Try without Valgrind, put a CHKMEMQ; just before the call to LandauKokkosJacobian and as its first line. And run with -malloc_debug. This is a less optimal way to find memory corruption but may be more useful in this case.</div></blockquote><div><br></div><div>I don't seem to get anything with this, but I now see that the segv is on the 2nd call to LandauKokkosJacobian, which adds the mass matrix, with shift. I am working on the mass matrix part now. Let me try adding print statements in LandauKokkosJacobian. (DDT failed to trace into that method, but let's see).</div><div><br></div><div>Thanks,</div><div><div><br></div><div>      CHKMEMQ;<br>      PetscPrintf(PETSC_COMM_SELF,"call LandauKokkosJacobian\n");<br>      ierr = LandauKokkosJacobian(ctx->plex,Nq,Eq_m,IPf,N,xdata,ctx->SData_d,ctx->subThreadBlockSize,shift,ctx->events,JacP);CHKERRQ(ierr);<br></div><div></div></div><div><br></div><div>00:37 adams/landau-mass-opt *= /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/utils/dmplexlandau/tutorials$ make PETSC_ARCH=arch-summit-opt-gnu-kokkos-notpl-cuda10 -f mymake tiny EXTRA='-dm_mat_type aijkokkos -dm_vec_type kokkos -malloc_debug' DEVICE=kokkos<br>jsrun -n 1 -c 1 -g 1 ./ex2 -dim 2 -ex2_test_type none -dm_landau_Ez 0 -petscspace_degree 3 -dm_preallocate_only -dm_landau_type p4est -dm_landau_ion_masses 1 -dm_landau_ion_charges 1 -dm_landau_thermal_temps 4,4 -dm_landau_n 1,1 -ts_monitorx -snes_rtol 1.e-14 -snes_stol 1.e-14 -snes_monitor -snes_converged_reason -snes_max_it 14 -ts_type beuler -ts_exact_final_time stepover -ts_max_snes_failures 1 -ts_rtol 5e-1 -ts_dt .5 -ts_max_steps 1 -pc_type lu -ksp_type preonly -dm_landau_amr_levels_max 13 -dm_landau_device_type kokkos -dm_mat_type aijkokkos -dm_vec_type kokkos<b> -malloc_debug</b><br></div><div><br></div><div><br></div><div>[0]FormLandau: 1280 IPs, 80 cells, totDim=32, Nb=16, Nq=16, elemMatSize=1024, dim=2, Tab: Nb=16 Nf=2 Np=16 cdim=2 N=1406 shift=0.<br><b>call LandauKokkosJacobian<br></b>    0 SNES Function norm 4.974994975313e-03<br><b>call LandauKokkosJacobian<br></b>[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="https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind">https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a><br>[0]PETSC ERROR: or try <a href="http://valgrind.org">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors<br>[0]PETSC ERROR: likely location of problem given in stack below<br>[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------<br>[0]PETSC ERROR: The EXACT line numbers in the error traceback are not available.<br>[0]PETSC ERROR: instead the line number of the start of the function is given.<br>[0]PETSC ERROR: #1 LandauKokkosJacobian() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/utils/dmplexlandau/kokkos/landau.kokkos.cxx:272<br>[0]PETSC ERROR: #2 LandauFormJacobian_Internal() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/utils/dmplexlandau/plexland.c:66<br>[0]PETSC ERROR: #3 LandauIJacobian() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/utils/dmplexlandau/plexland.c:2093<br>[0]PETSC ERROR: #4 TS user implicit Jacobian() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/interface/ts.c:933<br>[0]PETSC ERROR: #5 TSComputeIJacobian() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/interface/ts.c:916<br>[0]PETSC ERROR: #6 SNESTSFormJacobian_Theta() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/impls/implicit/theta/theta.c:1000<br>[0]PETSC ERROR: #7 SNESTSFormJacobian() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/interface/ts.c:4407<br>[0]PETSC ERROR: #8 SNES user Jacobian function() at /gpfs/alpine/csc314/scratch/adams/petsc/src/snes/interface/snes.c:2823<br>[0]PETSC ERROR: #9 SNESComputeJacobian() at /gpfs/alpine/csc314/scratch/adams/petsc/src/snes/interface/snes.c:2782<br>[0]PETSC ERROR: #10 SNESSolve() at /gpfs/alpine/csc314/scratch/adams/petsc/src/snes/interface/snes.c:4653<br>[0]PETSC ERROR: #11 TSTheta_SNESSolve() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/impls/implicit/theta/theta.c:184<br>[0]PETSC ERROR: #12 TSStep_Theta() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/impls/implicit/theta/theta.c:200<br>[0]PETSC ERROR: #13 TSStep() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/interface/ts.c:3548<br>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><br><blockquote type="cite"><div>On May 29, 2021, at 10:46 PM, Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>> wrote:</div><br><div><div dir="ltr">try gcc/6.4.0<br clear="all"><div><div dir="ltr"><div dir="ltr">--Junchao Zhang</div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 29, 2021 at 9:50 PM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">And I grief using gcc-8.1.1 and get this error:<div><br></div><div>/autofs/nccs-svm1_sw/summit/gcc/8.1.1/include/c++/8.1.1/type_traits(347): error: identifier "__ieee128" is undefined<br></div><div><br></div><div>Any ideas?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 29, 2021 at 10:39 PM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">And  valgrind sees this. I think the jump to the function is going to the wrong place. <div>I'm giving up on PGI but can try newer versions of GCC. (what is the deal with the range of major releases, 4-10?)<div>(as I said this looks like an error that a user is getting so I'd like to figure it out).</div><div><br></div><div>    0 SNES Function norm 4.974994975313e-03<br>==77820== Invalid read of size 4<br>==77820==    at 0x7E69068: LandauKokkosJacobian (in /gpfs/alpine/csc314/scratch/adams/petsc/arch-summit-opt-gnu-kokkos-notpl-cuda10/lib/libpetsc.so.3.015.0)<br>==77820==    by 0x7C598AF: LandauFormJacobian_Internal (plexland.c:212)<br>==77820==    by 0x7C728D3: LandauIJacobian (plexland.c:2107)<br>==77820==    by 0x7C8C26B: TSComputeIJacobian (ts.c:934)<br>==77820==    by 0x7E28337: SNESTSFormJacobian_Theta (theta.c:1007)<br>==77820==    by 0x7CBBFD3: SNESTSFormJacobian (ts.c:4415)<br>==77820==    by 0x7AD84BF: SNESComputeJacobian (snes.c:2824)<br>==77820==    by 0x7BA945B: SNESSolve_NEWTONLS (ls.c:222)<br>==77820==    by 0x7AF336F: SNESSolve (snes.c:4769)<br>==77820==    by 0x7E19D13: TSTheta_SNESSolve (theta.c:185)<br>==77820==    by 0x7E1A8B7: TSStep_Theta (theta.c:223)<br>==77820==    by 0x7CB093F: TSStep (ts.c:3571)<br>==77820==  Address 0x96fff690 is in a --- anonymous segment<br>==77820==<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="https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank">https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a><br>[0]PETSC ERROR: or try <a href="http://valgrind.org/" target="_blank">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors<br>[0]PETSC ERROR: likely location of problem given in stack below<br>[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------<br>[0]PETSC ERROR: The EXACT line numbers in the error traceback are not available.<br>[0]PETSC ERROR: instead the line number of the start of the function is given.<br>[0]PETSC ERROR: #1 LandauKokkosJacobian() at /gpfs/alpine/csc314/scratch/adams/petsc/src/ts/utils/dmplexlandau/kokkos/landau.kokkos.cxx:272<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 29, 2021 at 8:46 PM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 29, 2021 at 7:48 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
   I don't see why it is not running the Kokkos check. Here is the rule right below the CUDA rule that is apparently running.<br>
<br>
check_build:<br>
        -@echo "Running check examples to verify correct installation"<br>
        -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"<br>
        +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy<br>
        +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19<br>
        +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] &&  [ "${PETSC_SCALAR}" = "real" ]; then \<br>
          cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_hypre; \<br>
         fi;<br>
        +@if [ "${CUDA_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] &&  [ "${PETSC_SCALAR}" = "real" ]; then \<br>
          cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_cuda; \<br>
         fi;<br>
        +@if [ "${KOKKOS_KERNELS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] &&  [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ] && [ "${MPI_IS_MPIUNI}" = "0" ]; then \<br>
          cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex3k_kokkos; \<br>
         fi;<br>
<br>
  Regarding the debugging, if it is just one MPI rank (or even more) with GDB it will trap the error and show the exact line of source code where the error occurred and you can poke around at variables to see if they look corrupt or wrong (for example crazy address in a pointer), I don't know why your debugger is not giving more useful information. <br>
<br></blockquote><div><br></div><div>This is what I did (in DDT). It stopped at the function call and the data looked fine. I stepped into the call, but didn't get to it. The signal handler was called and I was dead.</div><div>Maybe I did something in my branch. Can't see what, but I keep probing,</div><div>Thanks,</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  Barry<br>
<br>
<br>
> On May 29, 2021, at 2:16 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:<br>
> <br>
> I am running on Summit with Kokkos-CUDA and I am getting a segv that looks like some sort of a compile/link mismatch. I also have a user with a C++ code that is getting strange segvs when calling MatSetValues with CUDA (I know MatSetValues is not a cupsarse method, but that is the report that I have). I have no idea if these are related but they both involve C -- C++ calls ...<br>
> <br>
> I started with a clean build (attached) and I ran in DDT. DDT stopped at the call in plexland.c to the KokkosLanau operator. I stepped into this function and then took this screenshot of the stack, with the Kokkos call and PETSc signal handler.<br>
> <br>
> Make check does not seem to be running Kokkos tests:<br>
> <br>
> 15:02 adams/landau-mass-opt *= /gpfs/alpine/csc314/scratch/adams/petsc$ make PETSC_DIR=/gpfs/alpine/csc314/scratch/adams/petsc PETSC_ARCH=arch-summit-opt-gnu-kokkos-notpl-cuda10 check<br>
> Running check examples to verify correct installation<br>
> Using PETSC_DIR=/gpfs/alpine/csc314/scratch/adams/petsc and PETSC_ARCH=arch-summit-opt-gnu-kokkos-notpl-cuda10<br>
> C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process<br>
> C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes<br>
> C/C++ example src/snes/tutorials/ex19 run successfully with cuda<br>
> Completed test examples<br>
> <br>
> Also, I ran this AM with another branch that had not been rebased with main as recently as this branch (adams/landau-mass-opt).<br>
> <br>
> Any ideas?<br>
> <make.log><configure.log><Screen Shot 2021-05-29 at 2.51.00 PM.png><br>
<br>
</blockquote></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</div></blockquote></div><br></div></blockquote></div></div>