Aah that is a nice trick, I was getting ready to fork, clone the fork and redo the work, but that worked fine ! Thank you Barry !
The MR will appear in a little while ! Thibault Le ven. 18 déc. 2020 à 10:16, Barry Smith <[email protected]> a écrit : > > Good question. There is a trick to limit the amount of work you need to > do with a new fork after you have already made changes with a PETSc clone, > but it looks like we do not document this clearly in the webpages. (I > couldn't find it). > > Yes, you do need to make a fork, but after you have made the fork on the > GitLab website (and have done nothing on your machine) edit the file > $PETSC_DIR/.git/config for your clone on your machine > > Locate the line that has url = [email protected]:petsc/petsc.git (this > may have an https at the beginning of the line) > > Change this line to point to the fork url instead with git@ not https, > which will be pretty much the same URL but with your user id instead of > petsc in the address. Then git push and it will push to your fork. > > Now you changes will be in your fork and you can make the MR from your > fork URL on Gitlab. (In other words this editing trick converts your PETSc > clone on your machine to a PETSc fork). > > I hope I have explained this clearly enough it goes smoothly. > > Barry > > > > On Dec 18, 2020, at 3:00 AM, Thibault Bridel-Bertomeu < > [email protected]> wrote: > > Hello Barry, > > I'll start the MR as soon as possible then so that specialists can indeed > have a look. Do I have to fork PETSc to start a MR or are PETSc repo > settings such that can I push a branch from the PETSc clone I got ? > > Thibault > > > Le mer. 16 déc. 2020 à 07:47, Barry Smith <[email protected]> a écrit : > >> >> Thibault, >> >> A subdirectory for the example is fine; we have other examples that use >> subdirectories and multiple files. >> >> Note: even if you don't have something completely working you can still >> make MR and list it as DRAFT request for comments, some other PETSc members >> who understand the packages you are using and Fortran better than I may be >> able to help as you develop the code. >> >> Barry >> >> >> >> >> On Dec 16, 2020, at 12:35 AM, Thibault Bridel-Bertomeu < >> [email protected]> wrote: >> >> Hello everyone, >> >> Thank you Barry for the feedback. >> OK, yes I'll work up an MR as soon as I have got something working. By >> the way, does the fortran-version of the example have to be a single file ? >> If my push contains a directory with several files (different modules and >> the main), and the Makefile that goes with it, is that ok ? >> >> Thibault Bridel-Bertomeu >> >> >> Le mer. 16 déc. 2020 à 04:46, Barry Smith <[email protected]> a écrit : >> >>> >>> This is great. If you make a branch off of the PETSc git repository >>> with these additions and work on ex11 you can make a merge request and we >>> can run the code easily on all our test systems (for security reasons one >>> of use needs to launch the tests from your MR). >>> https://docs.petsc.org/en/latest/developers/integration/ >>> >>> Barry >>> >>> >>> On Dec 15, 2020, at 5:35 AM, Thibault Bridel-Bertomeu < >>> [email protected]> wrote: >>> >>> Hello everyone, >>> >>> So far, I have the wrappers in the files attached to this e-mail. I >>> still do not know if they work properly - at least the code compiles and >>> the calls to the wrapped-subroutine do not fail - but I wanted to put this >>> here in case someone sees something really wrong with it already. >>> >>> Thank you again for your help, I'll try to post updates of the F90 >>> version of ex11 regularly in this thread. >>> >>> Stay safe, >>> >>> Thibault Bridel-Bertomeu >>> >>> Le dim. 13 déc. 2020 à 16:39, Jed Brown <[email protected]> a écrit : >>> >>>> Thibault Bridel-Bertomeu <[email protected]> writes: >>>> >>>> > Thank you Mark for your answer. >>>> > >>>> > I am not sure what you think could be in the setBC1 routine ? How to >>>> make >>>> > the connection with the PetscDS ? >>>> > >>>> > On the other hand, I actually found after a while TSMonitorSet has a >>>> > fortran wrapper, and it does take as arguments two function pointers, >>>> so I >>>> > guess it is possible ? Although I am not sure exactly how to play >>>> with the >>>> > PetscObjectSetFortranCallback & PetscObjectUseFortranCallback macros - >>>> > could anybody advise please ? >>>> >>>> tsmonitorset_ is a good example to follow. In your file, create one of >>>> these static structs with a member for each callback. These are IDs that >>>> will be used as keys for Fortran callbacks and their contexts. The salient >>>> parts of the file are below. >>>> >>>> static struct { >>>> PetscFortranCallbackId prestep; >>>> PetscFortranCallbackId poststep; >>>> PetscFortranCallbackId rhsfunction; >>>> PetscFortranCallbackId rhsjacobian; >>>> PetscFortranCallbackId ifunction; >>>> PetscFortranCallbackId ijacobian; >>>> PetscFortranCallbackId monitor; >>>> PetscFortranCallbackId mondestroy; >>>> PetscFortranCallbackId transform; >>>> #if defined(PETSC_HAVE_F90_2PTR_ARG) >>>> PetscFortranCallbackId function_pgiptr; >>>> #endif >>>> } _cb; >>>> >>>> /* >>>> Note ctx is the same as ts so we need to get the Fortran context out >>>> of the TS; this gets put in _ctx using the callback ID >>>> */ >>>> static PetscErrorCode ourmonitor(TS ts,PetscInt i,PetscReal d,Vec >>>> v,void *ctx) >>>> { >>>> >>>> PetscObjectUseFortranCallback(ts,_cb.monitor,(TS*,PetscInt*,PetscReal*,Vec >>>> *,void*,PetscErrorCode*),(&ts,&i,&d,&v,_ctx,&ierr)); >>>> } >>>> >>>> Then follow as in tsmonitorset_, which sets two callbacks. >>>> >>>> PETSC_EXTERN void tsmonitorset_(TS *ts,void >>>> (*func)(TS*,PetscInt*,PetscReal*,Vec*,void*,PetscErrorCode*),void >>>> *mctx,void (*d)(void*,PetscErrorCode*),PetscErrorCode *ierr) >>>> { >>>> CHKFORTRANNULLFUNCTION(d); >>>> if ((PetscVoidFunction)func == (PetscVoidFunction) tsmonitordefault_) >>>> { >>>> *ierr = TSMonitorSet(*ts,(PetscErrorCode >>>> (*)(TS,PetscInt,PetscReal,Vec,void*))TSMonitorDefault,*(PetscViewerAndFormat**)mctx,(PetscErrorCode >>>> (*)(void **))PetscViewerAndFormatDestroy); >>>> } else { >>>> *ierr = >>>> PetscObjectSetFortranCallback((PetscObject)*ts,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitor,(PetscVoidFunction)func,mctx); >>>> *ierr = >>>> PetscObjectSetFortranCallback((PetscObject)*ts,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.mondestroy,(PetscVoidFunction)d,mctx); >>>> *ierr = TSMonitorSet(*ts,ourmonitor,*ts,ourmonitordestroy); >>>> } >>>> } >>>> >>> <wrapper_petsc.h90><wrapper_petsc.c> >>> >>> >>> >> >
