Re: [petsc-users] PetscSF Fortran interface
How about this? PetscInt, pointer :: remoteOffsets(:) call PetscSFCreateRemoteOffsetsf90(distributionSF, section_filt_l, leafSection, remoteoffsets, ierr ) call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, remoteoffsets, leafSection, distributionSF_dof, ierr) call PetscIntArray1dDestroyF90(remoteOffsets,ierr) // free remoteoffsets when not needed On Thu, Jan 12, 2023 at 11:11 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > That is what I tried initially however, I get a segmentation fault. I can > confirm it's due to the remote offsets because if I try and output > remoteoffsets between the Distribute Section and Create Section it throws > the same segmentation fault. > > Thanks for the help > Nicholas > > On Thu, Jan 12, 2023 at 11:56 PM Junchao Zhang > wrote: > >> >> >> On Thu, Jan 12, 2023 at 1:28 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> Going back to this merge request. I'm not sure I follow exactly the >>> usage described in the commit history. I have a c prototype of what I am >>> trying to do which is >>> >>> PetscSectionCreate(PETSC_COMM_WORLD, ); >>> PetscSFDistributeSection(redistributionSF, filteredSection_local, >>> , >>> leafSection); >>> PetscSFCreateSectionSF(redistributionSF, filteredSection_local, >>> remoteOffsets, leafSection, _dof); >>> >>> But something seems unclear with the usage in fortran around the >>> remoteoffsets. Do I have to insert the CreateRemoteOffsetsF90 like so? Any >>> clarification would be greatly appreciated. >>> >>> call PetscSFDistributeSectionF90(distributionSF, section_filt_l, >>> remoteoffsets, leafSection, ierr) >>> call PetscSFCreateRemoteOffsetsf90(distributionSF, section_filt_l, >>> leafSection, remoteoffsets, ierr ) >>> call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, >>> remoteoffsets, leafSection, distributionSF_dof, ierr) >>> >>> Hi, Nicholas, >> Reading through comments at >> https://gitlab.com/petsc/petsc/-/merge_requests/5386#note_1022942470, I >> feel it should look like >> >> PetscInt, pointer :: remoteOffsets(:) >> call PetscSFDistributeSectionF90(distributionSF, section_filt_l, >> remoteoffsets, leafSection, ierr) // allocate remoteoffsets >> call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, >> remoteoffsets, leafSection, distributionSF_dof, ierr) >> call PetscIntArray1dDestroyF90(remoteOffsets,ierr) // free remoteoffsets >> when not needed >> >> Could you try it? >> >> >> Sincerely >>> Nicholas >>> >>> On Tue, Jan 10, 2023 at 4:42 PM Junchao Zhang >>> wrote: >>> Hi, Nicholas, It seems we have implemented it, but with another name, PetscSFCreateSectionSFF90, see https://gitlab.com/petsc/petsc/-/merge_requests/5386 Try it to see if it works! --Junchao Zhang On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Er to be honest I still can't get my stub to compile properly, and I > don't know how to go about making a merge request. But here is what I am > attempting right now. Let me know how best to proceed > > > Its not exactly clear to me how to setup up the remote offset > properly. > > in src/vec/is/sf/interface/ftn-custom/zsf.c > > PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection > *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, > PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) > { > > int * remoteOffsets; > *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) > PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; > *ierr = PetscSFCreateSectionSF(*sf,*rootSection, > ,*leafSection,*sectionSF);if (*ierr) return; > > } > > This is the sticking point. > > Sincerely > Nicholas > > > On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang < > junchao.zh...@gmail.com> wrote: > >> Hi, Nicholas, >> Could you make a merge request to PETSc and then our Fortran >> experts can comment on your MR? >> Thanks. >> >> --Junchao Zhang >> >> >> On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> I think I'm almost there, but I could use some insight into how to >>> use the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset >>> parameter input so if another function comes up, I can add it myself >>> without wasting your time. >>> I am very grateful for your help and time. >>> >>> Sincerely >>> Nicholas >>> >>> On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang < >>> junchao.zh...@gmail.com> wrote: >>> Hi, Nicholas, I am not a fortran guy, but I will try to add petscsfcreatesectionsf. Thanks. --Junchao Zhang
Re: [petsc-users] PetscSF Fortran interface
That is what I tried initially however, I get a segmentation fault. I can confirm it's due to the remote offsets because if I try and output remoteoffsets between the Distribute Section and Create Section it throws the same segmentation fault. Thanks for the help Nicholas On Thu, Jan 12, 2023 at 11:56 PM Junchao Zhang wrote: > > > On Thu, Jan 12, 2023 at 1:28 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> Going back to this merge request. I'm not sure I follow exactly the usage >> described in the commit history. I have a c prototype of what I am trying >> to do which is >> >> PetscSectionCreate(PETSC_COMM_WORLD, ); >> PetscSFDistributeSection(redistributionSF, filteredSection_local, >> , >> leafSection); >> PetscSFCreateSectionSF(redistributionSF, filteredSection_local, >> remoteOffsets, leafSection, _dof); >> >> But something seems unclear with the usage in fortran around the >> remoteoffsets. Do I have to insert the CreateRemoteOffsetsF90 like so? Any >> clarification would be greatly appreciated. >> >> call PetscSFDistributeSectionF90(distributionSF, section_filt_l, >> remoteoffsets, leafSection, ierr) >> call PetscSFCreateRemoteOffsetsf90(distributionSF, section_filt_l, >> leafSection, remoteoffsets, ierr ) >> call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, >> remoteoffsets, leafSection, distributionSF_dof, ierr) >> >> Hi, Nicholas, > Reading through comments at > https://gitlab.com/petsc/petsc/-/merge_requests/5386#note_1022942470, I > feel it should look like > > PetscInt, pointer :: remoteOffsets(:) > call PetscSFDistributeSectionF90(distributionSF, section_filt_l, > remoteoffsets, leafSection, ierr) // allocate remoteoffsets > call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, > remoteoffsets, leafSection, distributionSF_dof, ierr) > call PetscIntArray1dDestroyF90(remoteOffsets,ierr) // free remoteoffsets > when not needed > > Could you try it? > > > Sincerely >> Nicholas >> >> On Tue, Jan 10, 2023 at 4:42 PM Junchao Zhang >> wrote: >> >>> Hi, Nicholas, >>>It seems we have implemented it, but with another name, >>> PetscSFCreateSectionSFF90, see >>> https://gitlab.com/petsc/petsc/-/merge_requests/5386 >>>Try it to see if it works! >>> >>> --Junchao Zhang >>> >>> >>> On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Er to be honest I still can't get my stub to compile properly, and I don't know how to go about making a merge request. But here is what I am attempting right now. Let me know how best to proceed Its not exactly clear to me how to setup up the remote offset properly. in src/vec/is/sf/interface/ftn-custom/zsf.c PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) { int * remoteOffsets; *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,*leafSection,*sectionSF);if (*ierr) return; } This is the sticking point. Sincerely Nicholas On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang wrote: > Hi, Nicholas, > Could you make a merge request to PETSc and then our Fortran experts > can comment on your MR? > Thanks. > > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> I think I'm almost there, but I could use some insight into how to >> use the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset >> parameter input so if another function comes up, I can add it myself >> without wasting your time. >> I am very grateful for your help and time. >> >> Sincerely >> Nicholas >> >> On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang < >> junchao.zh...@gmail.com> wrote: >> >>> Hi, Nicholas, >>>I am not a fortran guy, but I will try to add >>> petscsfcreatesectionsf. >>> >>>Thanks. >>> --Junchao Zhang >>> >>> >>> On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> I think it should be something like this, but I'm not very fluent in Fortran C interop syntax. Any advice would be appreciated. Thanks PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO (remoteoffsetsd)) { int * remoteOffsets; *ierr = F90Array1dAccess(aremoteOffsets,
Re: [petsc-users] PetscSF Fortran interface
On Thu, Jan 12, 2023 at 1:28 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > Going back to this merge request. I'm not sure I follow exactly the usage > described in the commit history. I have a c prototype of what I am trying > to do which is > > PetscSectionCreate(PETSC_COMM_WORLD, ); > PetscSFDistributeSection(redistributionSF, filteredSection_local, > , > leafSection); > PetscSFCreateSectionSF(redistributionSF, filteredSection_local, > remoteOffsets, leafSection, _dof); > > But something seems unclear with the usage in fortran around the > remoteoffsets. Do I have to insert the CreateRemoteOffsetsF90 like so? Any > clarification would be greatly appreciated. > > call PetscSFDistributeSectionF90(distributionSF, section_filt_l, > remoteoffsets, leafSection, ierr) > call PetscSFCreateRemoteOffsetsf90(distributionSF, section_filt_l, > leafSection, remoteoffsets, ierr ) > call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, > remoteoffsets, leafSection, distributionSF_dof, ierr) > > Hi, Nicholas, Reading through comments at https://gitlab.com/petsc/petsc/-/merge_requests/5386#note_1022942470, I feel it should look like PetscInt, pointer :: remoteOffsets(:) call PetscSFDistributeSectionF90(distributionSF, section_filt_l, remoteoffsets, leafSection, ierr) // allocate remoteoffsets call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, remoteoffsets, leafSection, distributionSF_dof, ierr) call PetscIntArray1dDestroyF90(remoteOffsets,ierr) // free remoteoffsets when not needed Could you try it? Sincerely > Nicholas > > On Tue, Jan 10, 2023 at 4:42 PM Junchao Zhang > wrote: > >> Hi, Nicholas, >>It seems we have implemented it, but with another name, >> PetscSFCreateSectionSFF90, see >> https://gitlab.com/petsc/petsc/-/merge_requests/5386 >>Try it to see if it works! >> >> --Junchao Zhang >> >> >> On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Er to be honest I still can't get my stub to compile properly, and I >>> don't know how to go about making a merge request. But here is what I am >>> attempting right now. Let me know how best to proceed >>> >>> >>> Its not exactly clear to me how to setup up the remote offset properly. >>> >>> in src/vec/is/sf/interface/ftn-custom/zsf.c >>> >>> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection >>> *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >>> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >>> { >>> >>> int * remoteOffsets; >>> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) >>> PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; >>> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, >>> ,*leafSection,*sectionSF);if (*ierr) return; >>> >>> } >>> >>> This is the sticking point. >>> >>> Sincerely >>> Nicholas >>> >>> >>> On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang >>> wrote: >>> Hi, Nicholas, Could you make a merge request to PETSc and then our Fortran experts can comment on your MR? Thanks. --Junchao Zhang On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > I think I'm almost there, but I could use some insight into how to use > the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset > parameter input so if another function comes up, I can add it myself > without wasting your time. > I am very grateful for your help and time. > > Sincerely > Nicholas > > On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang < > junchao.zh...@gmail.com> wrote: > >> Hi, Nicholas, >>I am not a fortran guy, but I will try to add >> petscsfcreatesectionsf. >> >>Thanks. >> --Junchao Zhang >> >> >> On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> I think it should be something like this, but I'm not very fluent in >>> Fortran C interop syntax. Any advice would be appreciated. Thanks >>> >>> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * >>> rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >>> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >>> { >>> >>> int * remoteOffsets; >>> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & >>> remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) >>> return; >>> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* >>> leafSection,*sectionSF);if (*ierr) return; >>> >>> } >>> >>> On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Junchao Thanks again for your help in November. I've been using the your merge request branch quite
Re: [petsc-users] PetscSF Fortran interface
Hi Junchao Going back to this merge request. I'm not sure I follow exactly the usage described in the commit history. I have a c prototype of what I am trying to do which is PetscSectionCreate(PETSC_COMM_WORLD, ); PetscSFDistributeSection(redistributionSF, filteredSection_local, , leafSection); PetscSFCreateSectionSF(redistributionSF, filteredSection_local, remoteOffsets, leafSection, _dof); But something seems unclear with the usage in fortran around the remoteoffsets. Do I have to insert the CreateRemoteOffsetsF90 like so? Any clarification would be greatly appreciated. call PetscSFDistributeSectionF90(distributionSF, section_filt_l, remoteoffsets, leafSection, ierr) call PetscSFCreateRemoteOffsetsf90(distributionSF, section_filt_l, leafSection, remoteoffsets, ierr ) call PetscSFCreateSectionSFF90(distributionSF, section_filt_l, remoteoffsets, leafSection, distributionSF_dof, ierr) Sincerely Nicholas On Tue, Jan 10, 2023 at 4:42 PM Junchao Zhang wrote: > Hi, Nicholas, >It seems we have implemented it, but with another name, > PetscSFCreateSectionSFF90, see > https://gitlab.com/petsc/petsc/-/merge_requests/5386 >Try it to see if it works! > > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Er to be honest I still can't get my stub to compile properly, and I >> don't know how to go about making a merge request. But here is what I am >> attempting right now. Let me know how best to proceed >> >> >> Its not exactly clear to me how to setup up the remote offset properly. >> >> in src/vec/is/sf/interface/ftn-custom/zsf.c >> >> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection >> *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >> { >> >> int * remoteOffsets; >> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) >> PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; >> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, >> ,*leafSection,*sectionSF);if (*ierr) return; >> >> } >> >> This is the sticking point. >> >> Sincerely >> Nicholas >> >> >> On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang >> wrote: >> >>> Hi, Nicholas, >>> Could you make a merge request to PETSc and then our Fortran experts >>> can comment on your MR? >>> Thanks. >>> >>> --Junchao Zhang >>> >>> >>> On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Junchao I think I'm almost there, but I could use some insight into how to use the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset parameter input so if another function comes up, I can add it myself without wasting your time. I am very grateful for your help and time. Sincerely Nicholas On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang wrote: > Hi, Nicholas, >I am not a fortran guy, but I will try to add > petscsfcreatesectionsf. > >Thanks. > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> I think it should be something like this, but I'm not very fluent in >> Fortran C interop syntax. Any advice would be appreciated. Thanks >> >> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * >> rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >> { >> >> int * remoteOffsets; >> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & >> remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return >> ; >> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* >> leafSection,*sectionSF);if (*ierr) return; >> >> } >> >> On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> Thanks again for your help in November. I've been using the your >>> merge request branch quite heavily. Would it be possible to add a >>> petscsfcreatesectionsf interface as well? >>> I'm trying to write it myself using your commits as a guide but I >>> have been struggling with handling the section parameter properly. >>> >>> Sincerely >>> Nicholas >>> >>> On Sat, Nov 19, 2022 at 9:44 PM Junchao Zhang < >>> junchao.zh...@gmail.com> wrote: >>> On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi > > Thanks, this is awesome. Thanks for the very prompt fix. Just one > question: will the array outputs on the fortran side copies (and need > to be > deallocated) or direct access to the dmplex? >
Re: [petsc-users] PetscSF Fortran interface
Hi Junchao I hope I didn't make making any errors; I created the merge request following those instructions and commented @ you. https://gitlab.com/petsc/petsc/-/merge_requests/5969 Sincerely Nicholas On Wed, Jan 11, 2023 at 9:16 AM Junchao Zhang wrote: > Hi, Nicholas, > See > https://petsc.org/release/developers/contributing/#starting-a-new-feature-branch > on how to contribute. > > You will need to create your own fork of petsc, then create a feature > branch and your code, and then ask for a merge request to merge your branch > to the petsc repo. > > Once you have the MR, we can figure out why it could not compile. > > Thanks for the contribution! > > --Junchao Zhang > > > On Wed, Jan 11, 2023 at 12:58 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> Apologies for not seeing that. Usually, the fortran90-specific functions >> have notes on the original C version, and I also can't >> see PetscSFCreateSectionSFF90 on the function list on the doc site. Thanks >> so much, and I saw your notes on the merge request. >> >> I don't suppose PetscSFReduceBegin and End are likewise hidden somewhere. >> I'm moving between distributions, and I can go forward with >> PetscSFBcastBegin, but I also need to go backward with Reduce. >> >> I feel like this is a one-to-one change from Bcast to Reduce, and I've >> added the relevant lines in src/vec/is/sf/interface/ftn-custom/zsf.c and >> src/vec/f90-mod/petscvec.h90 and it compiles fine, but I'm still getting a >> linking error for the Reduce routines. >> >> I need some input on what I'm missing here. I hope I didn't miss that >> this routine exists elsewhere. >> >> I've attached the two files, but it's not an ideal way to transmit >> changes. >> >> If I get some instructions on contributing, I can make a merge request >> for the changes if they are helpful. >> >> >> Thanks >> >> Nicholas >> >> On Tue, Jan 10, 2023 at 4:42 PM Junchao Zhang >> wrote: >> >>> Hi, Nicholas, >>>It seems we have implemented it, but with another name, >>> PetscSFCreateSectionSFF90, see >>> https://gitlab.com/petsc/petsc/-/merge_requests/5386 >>>Try it to see if it works! >>> >>> --Junchao Zhang >>> >>> >>> On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Er to be honest I still can't get my stub to compile properly, and I don't know how to go about making a merge request. But here is what I am attempting right now. Let me know how best to proceed Its not exactly clear to me how to setup up the remote offset properly. in src/vec/is/sf/interface/ftn-custom/zsf.c PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) { int * remoteOffsets; *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,*leafSection,*sectionSF);if (*ierr) return; } This is the sticking point. Sincerely Nicholas On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang wrote: > Hi, Nicholas, > Could you make a merge request to PETSc and then our Fortran experts > can comment on your MR? > Thanks. > > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> I think I'm almost there, but I could use some insight into how to >> use the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset >> parameter input so if another function comes up, I can add it myself >> without wasting your time. >> I am very grateful for your help and time. >> >> Sincerely >> Nicholas >> >> On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang < >> junchao.zh...@gmail.com> wrote: >> >>> Hi, Nicholas, >>>I am not a fortran guy, but I will try to add >>> petscsfcreatesectionsf. >>> >>>Thanks. >>> --Junchao Zhang >>> >>> >>> On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> I think it should be something like this, but I'm not very fluent in Fortran C interop syntax. Any advice would be appreciated. Thanks PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO (remoteoffsetsd)) { int * remoteOffsets; *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr)
Re: [petsc-users] PetscSF Fortran interface
Hi, Nicholas, See https://petsc.org/release/developers/contributing/#starting-a-new-feature-branch on how to contribute. You will need to create your own fork of petsc, then create a feature branch and your code, and then ask for a merge request to merge your branch to the petsc repo. Once you have the MR, we can figure out why it could not compile. Thanks for the contribution! --Junchao Zhang On Wed, Jan 11, 2023 at 12:58 AM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > Apologies for not seeing that. Usually, the fortran90-specific functions > have notes on the original C version, and I also can't > see PetscSFCreateSectionSFF90 on the function list on the doc site. Thanks > so much, and I saw your notes on the merge request. > > I don't suppose PetscSFReduceBegin and End are likewise hidden somewhere. > I'm moving between distributions, and I can go forward with > PetscSFBcastBegin, but I also need to go backward with Reduce. > > I feel like this is a one-to-one change from Bcast to Reduce, and I've > added the relevant lines in src/vec/is/sf/interface/ftn-custom/zsf.c and > src/vec/f90-mod/petscvec.h90 and it compiles fine, but I'm still getting a > linking error for the Reduce routines. > > I need some input on what I'm missing here. I hope I didn't miss that this > routine exists elsewhere. > > I've attached the two files, but it's not an ideal way to transmit > changes. > > If I get some instructions on contributing, I can make a merge request for > the changes if they are helpful. > > > Thanks > > Nicholas > > On Tue, Jan 10, 2023 at 4:42 PM Junchao Zhang > wrote: > >> Hi, Nicholas, >>It seems we have implemented it, but with another name, >> PetscSFCreateSectionSFF90, see >> https://gitlab.com/petsc/petsc/-/merge_requests/5386 >>Try it to see if it works! >> >> --Junchao Zhang >> >> >> On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Er to be honest I still can't get my stub to compile properly, and I >>> don't know how to go about making a merge request. But here is what I am >>> attempting right now. Let me know how best to proceed >>> >>> >>> Its not exactly clear to me how to setup up the remote offset properly. >>> >>> in src/vec/is/sf/interface/ftn-custom/zsf.c >>> >>> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection >>> *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >>> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >>> { >>> >>> int * remoteOffsets; >>> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) >>> PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; >>> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, >>> ,*leafSection,*sectionSF);if (*ierr) return; >>> >>> } >>> >>> This is the sticking point. >>> >>> Sincerely >>> Nicholas >>> >>> >>> On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang >>> wrote: >>> Hi, Nicholas, Could you make a merge request to PETSc and then our Fortran experts can comment on your MR? Thanks. --Junchao Zhang On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > I think I'm almost there, but I could use some insight into how to use > the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset > parameter input so if another function comes up, I can add it myself > without wasting your time. > I am very grateful for your help and time. > > Sincerely > Nicholas > > On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang < > junchao.zh...@gmail.com> wrote: > >> Hi, Nicholas, >>I am not a fortran guy, but I will try to add >> petscsfcreatesectionsf. >> >>Thanks. >> --Junchao Zhang >> >> >> On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> I think it should be something like this, but I'm not very fluent in >>> Fortran C interop syntax. Any advice would be appreciated. Thanks >>> >>> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * >>> rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >>> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >>> { >>> >>> int * remoteOffsets; >>> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & >>> remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) >>> return; >>> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* >>> leafSection,*sectionSF);if (*ierr) return; >>> >>> } >>> >>> On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Junchao Thanks again for your help in November. I've been using the your merge request branch quite heavily. Would it
Re: [petsc-users] PetscSF Fortran interface
Hi Junchao Apologies for not seeing that. Usually, the fortran90-specific functions have notes on the original C version, and I also can't see PetscSFCreateSectionSFF90 on the function list on the doc site. Thanks so much, and I saw your notes on the merge request. I don't suppose PetscSFReduceBegin and End are likewise hidden somewhere. I'm moving between distributions, and I can go forward with PetscSFBcastBegin, but I also need to go backward with Reduce. I feel like this is a one-to-one change from Bcast to Reduce, and I've added the relevant lines in src/vec/is/sf/interface/ftn-custom/zsf.c and src/vec/f90-mod/petscvec.h90 and it compiles fine, but I'm still getting a linking error for the Reduce routines. I need some input on what I'm missing here. I hope I didn't miss that this routine exists elsewhere. I've attached the two files, but it's not an ideal way to transmit changes. If I get some instructions on contributing, I can make a merge request for the changes if they are helpful. Thanks Nicholas On Tue, Jan 10, 2023 at 4:42 PM Junchao Zhang wrote: > Hi, Nicholas, >It seems we have implemented it, but with another name, > PetscSFCreateSectionSFF90, see > https://gitlab.com/petsc/petsc/-/merge_requests/5386 >Try it to see if it works! > > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Er to be honest I still can't get my stub to compile properly, and I >> don't know how to go about making a merge request. But here is what I am >> attempting right now. Let me know how best to proceed >> >> >> Its not exactly clear to me how to setup up the remote offset properly. >> >> in src/vec/is/sf/interface/ftn-custom/zsf.c >> >> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection >> *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >> { >> >> int * remoteOffsets; >> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) >> PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; >> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, >> ,*leafSection,*sectionSF);if (*ierr) return; >> >> } >> >> This is the sticking point. >> >> Sincerely >> Nicholas >> >> >> On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang >> wrote: >> >>> Hi, Nicholas, >>> Could you make a merge request to PETSc and then our Fortran experts >>> can comment on your MR? >>> Thanks. >>> >>> --Junchao Zhang >>> >>> >>> On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Junchao I think I'm almost there, but I could use some insight into how to use the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset parameter input so if another function comes up, I can add it myself without wasting your time. I am very grateful for your help and time. Sincerely Nicholas On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang wrote: > Hi, Nicholas, >I am not a fortran guy, but I will try to add > petscsfcreatesectionsf. > >Thanks. > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> I think it should be something like this, but I'm not very fluent in >> Fortran C interop syntax. Any advice would be appreciated. Thanks >> >> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * >> rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >> { >> >> int * remoteOffsets; >> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & >> remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return >> ; >> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* >> leafSection,*sectionSF);if (*ierr) return; >> >> } >> >> On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> Thanks again for your help in November. I've been using the your >>> merge request branch quite heavily. Would it be possible to add a >>> petscsfcreatesectionsf interface as well? >>> I'm trying to write it myself using your commits as a guide but I >>> have been struggling with handling the section parameter properly. >>> >>> Sincerely >>> Nicholas >>> >>> On Sat, Nov 19, 2022 at 9:44 PM Junchao Zhang < >>> junchao.zh...@gmail.com> wrote: >>> On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi > > Thanks, this is awesome. Thanks for the very prompt fix. Just one > question: will the array outputs on the fortran side copies
Re: [petsc-users] PetscSF Fortran interface
Hi, Nicholas, It seems we have implemented it, but with another name, PetscSFCreateSectionSFF90, see https://gitlab.com/petsc/petsc/-/merge_requests/5386 Try it to see if it works! --Junchao Zhang On Tue, Jan 10, 2023 at 11:45 AM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Er to be honest I still can't get my stub to compile properly, and I don't > know how to go about making a merge request. But here is what I am > attempting right now. Let me know how best to proceed > > > Its not exactly clear to me how to setup up the remote offset properly. > > in src/vec/is/sf/interface/ftn-custom/zsf.c > > PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection > *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, > PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) > { > > int * remoteOffsets; > *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) > PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; > *ierr = PetscSFCreateSectionSF(*sf,*rootSection, > ,*leafSection,*sectionSF);if (*ierr) return; > > } > > This is the sticking point. > > Sincerely > Nicholas > > > On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang > wrote: > >> Hi, Nicholas, >> Could you make a merge request to PETSc and then our Fortran experts >> can comment on your MR? >> Thanks. >> >> --Junchao Zhang >> >> >> On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> I think I'm almost there, but I could use some insight into how to use >>> the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset >>> parameter input so if another function comes up, I can add it myself >>> without wasting your time. >>> I am very grateful for your help and time. >>> >>> Sincerely >>> Nicholas >>> >>> On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang >>> wrote: >>> Hi, Nicholas, I am not a fortran guy, but I will try to add petscsfcreatesectionsf. Thanks. --Junchao Zhang On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > I think it should be something like this, but I'm not very fluent in > Fortran C interop syntax. Any advice would be appreciated. Thanks > > PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * > rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, > PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) > { > > int * remoteOffsets; > *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & > remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; > *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* > leafSection,*sectionSF);if (*ierr) return; > > } > > On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> Thanks again for your help in November. I've been using the your >> merge request branch quite heavily. Would it be possible to add a >> petscsfcreatesectionsf interface as well? >> I'm trying to write it myself using your commits as a guide but I >> have been struggling with handling the section parameter properly. >> >> Sincerely >> Nicholas >> >> On Sat, Nov 19, 2022 at 9:44 PM Junchao Zhang < >> junchao.zh...@gmail.com> wrote: >> >>> >>> >>> >>> On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Thanks, this is awesome. Thanks for the very prompt fix. Just one question: will the array outputs on the fortran side copies (and need to be deallocated) or direct access to the dmplex? >>> Direct access to internal data; no need to deallocate >>> >>> Sincerely Nicholas On Sat, Nov 19, 2022 at 8:21 PM Junchao Zhang < junchao.zh...@gmail.com> wrote: > Hi, Nicholas, > See this MR, > https://gitlab.com/petsc/petsc/-/merge_requests/5860 > It is in testing, but you can try branch > jczhang/add-petscsf-fortran to see if it works for you. > > Thanks. > --Junchao Zhang > > On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> Thanks. I was wondering if there is any update on this. I may >> write a small interface for those two routines myself in the interim >> but >> I'd appreciate any insight you have. >> >> Sincerely >> Nicholas >> >> On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang < >> junchao.zh...@gmail.com> wrote: >> >>> Hi, Nicholas, >>> I will have a look
Re: [petsc-users] PetscSF Fortran interface
Er to be honest I still can't get my stub to compile properly, and I don't know how to go about making a merge request. But here is what I am attempting right now. Let me know how best to proceed Its not exactly clear to me how to setup up the remote offset properly. in src/vec/is/sf/interface/ftn-custom/zsf.c PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection *rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) { int * remoteOffsets; *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,*leafSection,*sectionSF);if (*ierr) return; } This is the sticking point. Sincerely Nicholas On Tue, Jan 10, 2023 at 12:38 PM Junchao Zhang wrote: > Hi, Nicholas, > Could you make a merge request to PETSc and then our Fortran experts can > comment on your MR? > Thanks. > > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> I think I'm almost there, but I could use some insight into how to use >> the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset >> parameter input so if another function comes up, I can add it myself >> without wasting your time. >> I am very grateful for your help and time. >> >> Sincerely >> Nicholas >> >> On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang >> wrote: >> >>> Hi, Nicholas, >>>I am not a fortran guy, but I will try to add petscsfcreatesectionsf. >>> >>>Thanks. >>> --Junchao Zhang >>> >>> >>> On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> I think it should be something like this, but I'm not very fluent in Fortran C interop syntax. Any advice would be appreciated. Thanks PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) { int * remoteOffsets; *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* leafSection,*sectionSF);if (*ierr) return; } On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > Thanks again for your help in November. I've been using the your merge > request branch quite heavily. Would it be possible to add a > petscsfcreatesectionsf interface as well? > I'm trying to write it myself using your commits as a guide but I have > been struggling with handling the section parameter properly. > > Sincerely > Nicholas > > On Sat, Nov 19, 2022 at 9:44 PM Junchao Zhang > wrote: > >> >> >> >> On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi >>> >>> Thanks, this is awesome. Thanks for the very prompt fix. Just one >>> question: will the array outputs on the fortran side copies (and need >>> to be >>> deallocated) or direct access to the dmplex? >>> >> Direct access to internal data; no need to deallocate >> >> >>> >>> Sincerely >>> Nicholas >>> >>> On Sat, Nov 19, 2022 at 8:21 PM Junchao Zhang < >>> junchao.zh...@gmail.com> wrote: >>> Hi, Nicholas, See this MR, https://gitlab.com/petsc/petsc/-/merge_requests/5860 It is in testing, but you can try branch jczhang/add-petscsf-fortran to see if it works for you. Thanks. --Junchao Zhang On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > Thanks. I was wondering if there is any update on this. I may > write a small interface for those two routines myself in the interim > but > I'd appreciate any insight you have. > > Sincerely > Nicholas > > On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang < > junchao.zh...@gmail.com> wrote: > >> Hi, Nicholas, >> I will have a look and get back to you. >> Thanks. >> --Junchao Zhang >> >> >> On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Petsc Users >>> >>> I'm in the process of adding some Petsc for mesh management into >>> an existing Fortran Solver. It has been relatively straightforward >>> so far >>> but I am running into an issue with using PetscSF routines.
Re: [petsc-users] PetscSF Fortran interface
Hi, Nicholas, Could you make a merge request to PETSc and then our Fortran experts can comment on your MR? Thanks. --Junchao Zhang On Tue, Jan 10, 2023 at 11:10 AM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > I think I'm almost there, but I could use some insight into how to use the > PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset parameter > input so if another function comes up, I can add it myself without wasting > your time. > I am very grateful for your help and time. > > Sincerely > Nicholas > > On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang > wrote: > >> Hi, Nicholas, >>I am not a fortran guy, but I will try to add petscsfcreatesectionsf. >> >>Thanks. >> --Junchao Zhang >> >> >> On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> I think it should be something like this, but I'm not very fluent in >>> Fortran C interop syntax. Any advice would be appreciated. Thanks >>> >>> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * >>> rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >>> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >>> { >>> >>> int * remoteOffsets; >>> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & >>> remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; >>> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* >>> leafSection,*sectionSF);if (*ierr) return; >>> >>> } >>> >>> On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Junchao Thanks again for your help in November. I've been using the your merge request branch quite heavily. Would it be possible to add a petscsfcreatesectionsf interface as well? I'm trying to write it myself using your commits as a guide but I have been struggling with handling the section parameter properly. Sincerely Nicholas On Sat, Nov 19, 2022 at 9:44 PM Junchao Zhang wrote: > > > > On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi >> >> Thanks, this is awesome. Thanks for the very prompt fix. Just one >> question: will the array outputs on the fortran side copies (and need to >> be >> deallocated) or direct access to the dmplex? >> > Direct access to internal data; no need to deallocate > > >> >> Sincerely >> Nicholas >> >> On Sat, Nov 19, 2022 at 8:21 PM Junchao Zhang < >> junchao.zh...@gmail.com> wrote: >> >>> Hi, Nicholas, >>> See this MR, https://gitlab.com/petsc/petsc/-/merge_requests/5860 >>> It is in testing, but you can try branch >>> jczhang/add-petscsf-fortran to see if it works for you. >>> >>> Thanks. >>> --Junchao Zhang >>> >>> On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Junchao Thanks. I was wondering if there is any update on this. I may write a small interface for those two routines myself in the interim but I'd appreciate any insight you have. Sincerely Nicholas On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang < junchao.zh...@gmail.com> wrote: > Hi, Nicholas, > I will have a look and get back to you. > Thanks. > --Junchao Zhang > > > On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Petsc Users >> >> I'm in the process of adding some Petsc for mesh management into >> an existing Fortran Solver. It has been relatively straightforward >> so far >> but I am running into an issue with using PetscSF routines. Some >> like the >> PetscSFGetGraph work no problem but a few of my routines require the >> use of >> PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to >> be in >> the fortran interface and I just get a linking error. I also don't >> seem to >> see a PetscSF file in the finclude. Any clarification or assistance >> would >> be appreciated. >> >> >> Sincerely >> Nicholas >> >> -- >> Nicholas Arnold-Medabalimi >> >> Ph.D. Candidate >> Computational Aeroscience Lab >> University of Michigan >> > -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan >>> >> >> -- >> Nicholas Arnold-Medabalimi >> >> Ph.D. Candidate >> Computational Aeroscience Lab >> University of
Re: [petsc-users] PetscSF Fortran interface
Hi Junchao I think I'm almost there, but I could use some insight into how to use the PETSC_F90_2PTR_PROTO and F90Array1dAccess for the remoteOffset parameter input so if another function comes up, I can add it myself without wasting your time. I am very grateful for your help and time. Sincerely Nicholas On Tue, Jan 10, 2023 at 10:55 AM Junchao Zhang wrote: > Hi, Nicholas, >I am not a fortran guy, but I will try to add petscsfcreatesectionsf. > >Thanks. > --Junchao Zhang > > > On Tue, Jan 10, 2023 at 12:50 AM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> I think it should be something like this, but I'm not very fluent in >> Fortran C interop syntax. Any advice would be appreciated. Thanks >> >> PETSC_EXTERN void petscsfcreatesectionsf(PetscSF *sf, PetscSection * >> rootSection, F90Array1d *aremoteOffsets, PetscSection *leafSection, >> PetscSF *sectionSF, int * ierr PETSC_F90_2PTR_PROTO(remoteoffsetsd)) >> { >> >> int * remoteOffsets; >> *ierr = F90Array1dAccess(aremoteOffsets, PETSC_INT, (void**) & >> remoteOffsets PETSC_F90_2PTR_PARAM(remoteoffsetsd));if (*ierr) return; >> *ierr = PetscSFCreateSectionSF(*sf,*rootSection, ,* >> leafSection,*sectionSF);if (*ierr) return; >> >> } >> >> On Mon, Jan 9, 2023 at 11:41 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> Thanks again for your help in November. I've been using the your merge >>> request branch quite heavily. Would it be possible to add a >>> petscsfcreatesectionsf interface as well? >>> I'm trying to write it myself using your commits as a guide but I have >>> been struggling with handling the section parameter properly. >>> >>> Sincerely >>> Nicholas >>> >>> On Sat, Nov 19, 2022 at 9:44 PM Junchao Zhang >>> wrote: >>> On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi > > Thanks, this is awesome. Thanks for the very prompt fix. Just one > question: will the array outputs on the fortran side copies (and need to > be > deallocated) or direct access to the dmplex? > Direct access to internal data; no need to deallocate > > Sincerely > Nicholas > > On Sat, Nov 19, 2022 at 8:21 PM Junchao Zhang > wrote: > >> Hi, Nicholas, >> See this MR, https://gitlab.com/petsc/petsc/-/merge_requests/5860 >> It is in testing, but you can try branch >> jczhang/add-petscsf-fortran to see if it works for you. >> >> Thanks. >> --Junchao Zhang >> >> On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> Thanks. I was wondering if there is any update on this. I may write >>> a small interface for those two routines myself in the interim but I'd >>> appreciate any insight you have. >>> >>> Sincerely >>> Nicholas >>> >>> On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang < >>> junchao.zh...@gmail.com> wrote: >>> Hi, Nicholas, I will have a look and get back to you. Thanks. --Junchao Zhang On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Petsc Users > > I'm in the process of adding some Petsc for mesh management into > an existing Fortran Solver. It has been relatively straightforward so > far > but I am running into an issue with using PetscSF routines. Some like > the > PetscSFGetGraph work no problem but a few of my routines require the > use of > PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to > be in > the fortran interface and I just get a linking error. I also don't > seem to > see a PetscSF file in the finclude. Any clarification or assistance > would > be appreciated. > > > Sincerely > Nicholas > > -- > Nicholas Arnold-Medabalimi > > Ph.D. Candidate > Computational Aeroscience Lab > University of Michigan > >>> >>> -- >>> Nicholas Arnold-Medabalimi >>> >>> Ph.D. Candidate >>> Computational Aeroscience Lab >>> University of Michigan >>> >> > > -- > Nicholas Arnold-Medabalimi > > Ph.D. Candidate > Computational Aeroscience Lab > University of Michigan > >>> >>> -- >>> Nicholas Arnold-Medabalimi >>> >>> Ph.D. Candidate >>> Computational Aeroscience Lab >>> University of Michigan >>> >> >> >> -- >> Nicholas Arnold-Medabalimi >> >> Ph.D. Candidate >> Computational Aeroscience Lab >> University of Michigan >> > -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan
Re: [petsc-users] PetscSF Fortran interface
Hi Junchao Thanks again for your help in November. I've been using the your merge request branch quite heavily. Would it be possible to add a petscsfcreatesectionsf interface as well? I'm trying to write it myself using your commits as a guide but I have been struggling with handling the section parameter properly. Sincerely Nicholas On Sat, Nov 19, 2022 at 9:44 PM Junchao Zhang wrote: > > > > On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi >> >> Thanks, this is awesome. Thanks for the very prompt fix. Just one >> question: will the array outputs on the fortran side copies (and need to be >> deallocated) or direct access to the dmplex? >> > Direct access to internal data; no need to deallocate > > >> >> Sincerely >> Nicholas >> >> On Sat, Nov 19, 2022 at 8:21 PM Junchao Zhang >> wrote: >> >>> Hi, Nicholas, >>> See this MR, https://gitlab.com/petsc/petsc/-/merge_requests/5860 >>> It is in testing, but you can try branch >>> jczhang/add-petscsf-fortran to see if it works for you. >>> >>> Thanks. >>> --Junchao Zhang >>> >>> On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Junchao Thanks. I was wondering if there is any update on this. I may write a small interface for those two routines myself in the interim but I'd appreciate any insight you have. Sincerely Nicholas On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang wrote: > Hi, Nicholas, > I will have a look and get back to you. > Thanks. > --Junchao Zhang > > > On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Petsc Users >> >> I'm in the process of adding some Petsc for mesh management into an >> existing Fortran Solver. It has been relatively straightforward so far >> but >> I am running into an issue with using PetscSF routines. Some like the >> PetscSFGetGraph work no problem but a few of my routines require the use >> of >> PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to be in >> the fortran interface and I just get a linking error. I also don't seem >> to >> see a PetscSF file in the finclude. Any clarification or assistance would >> be appreciated. >> >> >> Sincerely >> Nicholas >> >> -- >> Nicholas Arnold-Medabalimi >> >> Ph.D. Candidate >> Computational Aeroscience Lab >> University of Michigan >> > -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan >>> >> >> -- >> Nicholas Arnold-Medabalimi >> >> Ph.D. Candidate >> Computational Aeroscience Lab >> University of Michigan >> > -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan
Re: [petsc-users] PetscSF Fortran interface
On Sat, Nov 19, 2022 at 8:05 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi > > Thanks, this is awesome. Thanks for the very prompt fix. Just one > question: will the array outputs on the fortran side copies (and need to be > deallocated) or direct access to the dmplex? > Direct access to internal data; no need to deallocate > > Sincerely > Nicholas > > On Sat, Nov 19, 2022 at 8:21 PM Junchao Zhang > wrote: > >> Hi, Nicholas, >> See this MR, https://gitlab.com/petsc/petsc/-/merge_requests/5860 >> It is in testing, but you can try branch jczhang/add-petscsf-fortran to >> see if it works for you. >> >> Thanks. >> --Junchao Zhang >> >> On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Junchao >>> >>> Thanks. I was wondering if there is any update on this. I may write a >>> small interface for those two routines myself in the interim but I'd >>> appreciate any insight you have. >>> >>> Sincerely >>> Nicholas >>> >>> On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang >>> wrote: >>> Hi, Nicholas, I will have a look and get back to you. Thanks. --Junchao Zhang On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Petsc Users > > I'm in the process of adding some Petsc for mesh management into an > existing Fortran Solver. It has been relatively straightforward so far but > I am running into an issue with using PetscSF routines. Some like the > PetscSFGetGraph work no problem but a few of my routines require the use > of > PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to be in > the fortran interface and I just get a linking error. I also don't seem to > see a PetscSF file in the finclude. Any clarification or assistance would > be appreciated. > > > Sincerely > Nicholas > > -- > Nicholas Arnold-Medabalimi > > Ph.D. Candidate > Computational Aeroscience Lab > University of Michigan > >>> >>> -- >>> Nicholas Arnold-Medabalimi >>> >>> Ph.D. Candidate >>> Computational Aeroscience Lab >>> University of Michigan >>> >> > > -- > Nicholas Arnold-Medabalimi > > Ph.D. Candidate > Computational Aeroscience Lab > University of Michigan >
Re: [petsc-users] PetscSF Fortran interface
Hi Thanks, this is awesome. Thanks for the very prompt fix. Just one question: will the array outputs on the fortran side copies (and need to be deallocated) or direct access to the dmplex? Sincerely Nicholas On Sat, Nov 19, 2022 at 8:21 PM Junchao Zhang wrote: > Hi, Nicholas, > See this MR, https://gitlab.com/petsc/petsc/-/merge_requests/5860 > It is in testing, but you can try branch jczhang/add-petscsf-fortran to > see if it works for you. > > Thanks. > --Junchao Zhang > > On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Junchao >> >> Thanks. I was wondering if there is any update on this. I may write a >> small interface for those two routines myself in the interim but I'd >> appreciate any insight you have. >> >> Sincerely >> Nicholas >> >> On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang >> wrote: >> >>> Hi, Nicholas, >>> I will have a look and get back to you. >>> Thanks. >>> --Junchao Zhang >>> >>> >>> On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < >>> narno...@umich.edu> wrote: >>> Hi Petsc Users I'm in the process of adding some Petsc for mesh management into an existing Fortran Solver. It has been relatively straightforward so far but I am running into an issue with using PetscSF routines. Some like the PetscSFGetGraph work no problem but a few of my routines require the use of PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to be in the fortran interface and I just get a linking error. I also don't seem to see a PetscSF file in the finclude. Any clarification or assistance would be appreciated. Sincerely Nicholas -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan >>> >> >> -- >> Nicholas Arnold-Medabalimi >> >> Ph.D. Candidate >> Computational Aeroscience Lab >> University of Michigan >> > -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan
Re: [petsc-users] PetscSF Fortran interface
Hi, Nicholas, See this MR, https://gitlab.com/petsc/petsc/-/merge_requests/5860 It is in testing, but you can try branch jczhang/add-petscsf-fortran to see if it works for you. Thanks. --Junchao Zhang On Sat, Nov 19, 2022 at 4:16 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Junchao > > Thanks. I was wondering if there is any update on this. I may write a > small interface for those two routines myself in the interim but I'd > appreciate any insight you have. > > Sincerely > Nicholas > > On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang > wrote: > >> Hi, Nicholas, >> I will have a look and get back to you. >> Thanks. >> --Junchao Zhang >> >> >> On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < >> narno...@umich.edu> wrote: >> >>> Hi Petsc Users >>> >>> I'm in the process of adding some Petsc for mesh management into an >>> existing Fortran Solver. It has been relatively straightforward so far but >>> I am running into an issue with using PetscSF routines. Some like the >>> PetscSFGetGraph work no problem but a few of my routines require the use of >>> PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to be in >>> the fortran interface and I just get a linking error. I also don't seem to >>> see a PetscSF file in the finclude. Any clarification or assistance would >>> be appreciated. >>> >>> >>> Sincerely >>> Nicholas >>> >>> -- >>> Nicholas Arnold-Medabalimi >>> >>> Ph.D. Candidate >>> Computational Aeroscience Lab >>> University of Michigan >>> >> > > -- > Nicholas Arnold-Medabalimi > > Ph.D. Candidate > Computational Aeroscience Lab > University of Michigan >
Re: [petsc-users] PetscSF Fortran interface
Hi Junchao Thanks. I was wondering if there is any update on this. I may write a small interface for those two routines myself in the interim but I'd appreciate any insight you have. Sincerely Nicholas On Wed, Nov 16, 2022 at 10:39 PM Junchao Zhang wrote: > Hi, Nicholas, > I will have a look and get back to you. > Thanks. > --Junchao Zhang > > > On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < > narno...@umich.edu> wrote: > >> Hi Petsc Users >> >> I'm in the process of adding some Petsc for mesh management into an >> existing Fortran Solver. It has been relatively straightforward so far but >> I am running into an issue with using PetscSF routines. Some like the >> PetscSFGetGraph work no problem but a few of my routines require the use of >> PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to be in >> the fortran interface and I just get a linking error. I also don't seem to >> see a PetscSF file in the finclude. Any clarification or assistance would >> be appreciated. >> >> >> Sincerely >> Nicholas >> >> -- >> Nicholas Arnold-Medabalimi >> >> Ph.D. Candidate >> Computational Aeroscience Lab >> University of Michigan >> > -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan
Re: [petsc-users] PetscSF Fortran interface
Hi, Nicholas, I will have a look and get back to you. Thanks. --Junchao Zhang On Wed, Nov 16, 2022 at 9:27 PM Nicholas Arnold-Medabalimi < narno...@umich.edu> wrote: > Hi Petsc Users > > I'm in the process of adding some Petsc for mesh management into an > existing Fortran Solver. It has been relatively straightforward so far but > I am running into an issue with using PetscSF routines. Some like the > PetscSFGetGraph work no problem but a few of my routines require the use of > PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to be in > the fortran interface and I just get a linking error. I also don't seem to > see a PetscSF file in the finclude. Any clarification or assistance would > be appreciated. > > > Sincerely > Nicholas > > -- > Nicholas Arnold-Medabalimi > > Ph.D. Candidate > Computational Aeroscience Lab > University of Michigan >
[petsc-users] PetscSF Fortran interface
Hi Petsc Users I'm in the process of adding some Petsc for mesh management into an existing Fortran Solver. It has been relatively straightforward so far but I am running into an issue with using PetscSF routines. Some like the PetscSFGetGraph work no problem but a few of my routines require the use of PetscSFGetLeafRanks and PetscSFGetRootRanks and those don't seem to be in the fortran interface and I just get a linking error. I also don't seem to see a PetscSF file in the finclude. Any clarification or assistance would be appreciated. Sincerely Nicholas -- Nicholas Arnold-Medabalimi Ph.D. Candidate Computational Aeroscience Lab University of Michigan