Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding DMStag functions as well as testing and documentation #119

Merged
merged 137 commits into from
Aug 3, 2021

Conversation

nicoberlie
Copy link
Contributor

  • Adding DMStag functionality into PETSc.jl
  • Adding documentation to newly introduced functions
  • Adding testing for additional functions
  • Adding examples using DMStag and Automatic Differentiation tools

boriskaus and others added 30 commits May 3, 2021 12:20
The SNES_ex2b example also illustrates how the automatic differentiation tools of julia (as provided in ForwardDiff.jl) can be employed to automatically generate the jacobian, so only a residual routine is required in this case
* added a few more routines
- added setting coordinates in 1/2/3D
- help comments added
- only valid for mpi_comm_self (problem?)
…into feature-DMSTAG

* 'feature-DMSTAG' of https://github.com/boriskaus/PETSc.jl:
  Correction output DOF (taking dim into account)
  DMStagGetDOF added
  DMStagCreateCompatibleDMStag added
  DMStagCreate3d added (+correction description 2d))
  DMStagCreate2D added and adapted
  added DMStageCreate2d

# Conflicts:
#	test/test_dmstag.jl
…s in julia style for PetscVec objects,

example:

X = rand(10)
V = PETSc.VecSeq(X)

V[1:2] = 2:3;
V[9:10] .= 99;
V[1:2] = V[8:9] .* V[1:2]
…into feature-DMSTAG

* 'feature-DMSTAG' of https://github.com/boriskaus/PETSc.jl:
  Little git mismanipulation, back again to for_libpetsc
  Clean up + links Petsc Manual in doc
  Revert "Corrected typo (for_petsc instead of for_libpetsc))"
  Fix dependency on SparseArrays
  Corrected typo (for_petsc instead of for_libpetsc))
@jkozdon
Copy link
Member

jkozdon commented Jul 9, 2021

So I got most of the work done on my side, and I am starting to fold some of the routines that you all call from DM into my PR.

I still need to fold in:

  • DMCreateGlobalVector
  • DMCreateLocalVector
  • DMLocalToGlobal
  • DMGlobalToLocal
  • DMCreateMatrix
  • DMGetCoordinateDM
  • DMGetCoordinatesLocal

Concerning DMStagVecSetValuesStencil I realized that I did a similar thing with MatStencil and MatSetValuesStencil (and here)

@boriskaus
Copy link
Collaborator

Thanks! Yes, putting the DM routines into a separate file makes sense.

This was referenced Jul 20, 2021
Some decisions to be discussed:
- having a user context associated to the snes structure
- the transmission of vectors vs arrays into the formfunction !fn()
@nicoberlie
Copy link
Contributor Author

nicoberlie commented Jul 27, 2021

All the tests now work. I reverted back on SNES to give back the vectors' pointers to use in the residual function as I thought it would be more explicit to transform it to an array in the personal code rather than the package itself (especially if it's associated to a dm). I also added a user context to the snes structure as it can be useful to carry some information in it. We can discuss those points if you want. All the other changes were fixes.

I know there is more changes that could be added but, at this point and knowing @jkozdon is working on an automatically generated wrapper, could we add this to the code and eventually add subsequent pull requests?

Enjoy your holiday, in the mean time I'll have a look at the structure DMSTAGSTENCIL

@boriskaus
Copy link
Collaborator

All tests work fine now so in principle this could be merged now.
Yet, compared to different parts of the package, we are only doing the test for one PETSc library. Perhaps it is worth adding a loop over libraries here so we test all combinations? I am not sure whether DMSTAG is even supposed to work with complex numbers, though.

@psanan
Copy link
Contributor

psanan commented Jul 27, 2021

DMStag is intended to work with complex numbers, but some of the tests that I currently have in PETSc (notably in src/dm/impls/stag/tutorials/ex4.c) are skipped in that case (have !complex in the /* TEST */ blocks) because they use direct solvers which don't support complex.

@nicoberlie
Copy link
Contributor Author

nicoberlie commented Jul 27, 2021 via email

@jkozdon
Copy link
Member

jkozdon commented Jul 28, 2021

That's true I also had troubles with other petsc libraries so I came back to the one we had before in the startup file, maybe we can discuss it Jeremy?

Sure we can discuss next week. I'll be back in the office Monday and can chat then.

@nicoberlie
Copy link
Contributor Author

nicoberlie commented Jul 28, 2021 via email

nicoberlie and others added 10 commits July 29, 2021 11:55
…are now within dm.jl. I commented those (for now) and changed a few routines such they have now a similar input/output to their DMDA counterparts. 1D tests are ok now, rest needs to be added
…eper changed in SNES and Mat routines. I'm not sure it makes sense to do that @ this time as @jkozdon has done much of that already in the branch that generates Clang bindings. Therefore I have deactivated testing of most of the DMSTAG examples for now.
@jkozdon jkozdon merged commit ff709d1 into JuliaParallel:master Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants