This Message Is From an External Sender
This message came from outside your organization.
hi Barry,
I tried pushing the branch of my code that contains the commits needed for your Fortran interface changes up to Github so it would try building it on the CI pipeline - so a completely clean VM with just a single fresh build of PETSc (your branch with the fixes) and of my code. That still failed with runtime errors, so I'm pretty sure the problem is not with me getting my branches mixed up. However having a closer look at ex1f.F90, I don't think the usage is quite the same as in my code. My code essentially calls SNESSetJacobian() like this: call SNESSetJacobian(snes, J, J, SNES_Jacobian, ctx, ierr) where ctx is an object of a derived type for my context - it contains the fd_coloring plus some other things. The SNES_Jacobian() routine looks like this: subroutine SNES_Jacobian(snes, y, J, B, ctx, ierr) where again ctx is the derived-type context. This SNES_Jacobian() then goes and calls SNESComputeJacobianDefaultColor(). In ex1f.F90 it basically just does: call SNESSetJacobian(snes, J, J, SNESComputeJacobianDefaultColor, fdcoloring, ierr) where fdcoloring is of type MatFDColoring (not some other context type). I think what my code does abides by the PETSc documentation which says the context can be any type (void*), not necessarily MatFDColoring. And, it used to work. If this kind of usage is no longer going to be supported I may be able to change it to something more like what ex1f.F90 does. My SNES_Jacobian() is basically just a wrapper for SNESComputeJacobianDefaultColor() now - I think it may have had some other things in it once but it doesn't now. However, this issue might cause trouble for other people as well. - Adrian On 22/06/24 1:20 am, Barry Smith wrote: > This is puzzling since I think the usage in your code is pretty much the same as the usage in ex1f.F90. Are you sure you are compiling and linking your code against your latest PETSc build in this branch? In particular, remove any generated module files, .o files, and your executable before building your application, and double-check PETSC_DIR and PETSC_ARCH. > > If there is still a problem then there is some subtle difference in the two codes that we don't see. You can try replacing SNESSetJacobian() in your code with SNESSetJacobianNoInterface() and see what happens. > > Barry > > > > >> On Jun 21, 2024, at 12:56 AM, Adrian Croucher <a.crouc...@auckland.ac.nz> wrote: >> >> hi Barry, >> >> On 21/06/24 10:54 am, Barry Smith wrote: >>> Can you get (again) the latest of the branch and try src/snes/tests/ex1f.F90 with the option -snes_fd_coloring and see if it works? >>> >>> Its funny my change broke your code since ex1f.F90 works for me. >> OK, I deleted the branch again, checked it out, did make clean, make allfortranstubs, make all. Then tried building src/snes/tests/ex1f, which failed with an error about "ex1f.F90:431: undefined reference to `petsclogflops_'". >> >> I wondered if something had got messed up somewhere and not cleaned up by make clean etc, so I tried building your whole branch again from scratch in a new build dir. Then I could build and run snes/tests/ex1f and run it with -snes_fd_coloring ok. >> >> However when I rebuilt my code in a new build dir against your PETSc branch, it built ok but I still got the runtime error "Wrong type of object: Parameter # 5" in SNESComputeJacobianDefaultColor(). >> >> - Adrian >> >> -- >> Dr Adrian Croucher >> Senior Research Fellow >> Department of Engineering Science >> Waipapa Taumata Rau / University of Auckland, New Zealand >> email: a.crouc...@auckland.ac.nz >> tel: +64 (0)9 923 4611 >> -- Dr Adrian Croucher Senior Research Fellow Department of Engineering Science Waipapa Taumata Rau / University of Auckland, New Zealand email: a.crouc...@auckland.ac.nz tel: +64 (0)9 923 4611