libCEED icon indicating copy to clipboard operation
libCEED copied to clipboard

Python PETSc Example BP1

Open tylercollins5737 opened this issue 7 months ago • 2 comments

Hello!

This is a Python implementation of bpsraw.c for BP1 and was initially discussed in #1774 . I'm aiming to recreate the benchmark behavior using libceed and petsc4py. I appreciate any feedback or indications I'm headed in the right direction!

It does run, but this is a work in progress. Remaining tasks:

  • [ ] fix the matrix operations to work like the MatShell C implementation
  • [ ] get PETSc Vec scatter working
  • [ ] QFunction
  • [ ] Error function
  • [ ] add meaningful comments
  • [x] improve the printed output metrics
  • [ ] create a test

tylercollins5737 avatar Apr 19 '25 09:04 tylercollins5737

@tylercollins5737 , thank you for your work. Are you able to address the reviewer's comments?

valeriabarra avatar May 20 '25 16:05 valeriabarra

@valeriabarra I was able to get it working using the "python" matrix type, MatAIJ was not the best. I believe the "python" type and MatCreateShell can achieve the same thing.

tylercollins5737 avatar May 20 '25 22:05 tylercollins5737

Hey @tylercollins5737 , how are you? I was wondering if you intended to complete this PR or if there were any impeding issues that you encountered.

There are a couple of other potential contributors that are eyeing this project and I was wondering if there was a missing interface for which this BP could not be completed or if it was just for personal reasons. Thank you!

valeriabarra avatar Oct 08 '25 21:10 valeriabarra

Hey @tylercollins5737 , how are you? I was wondering if you intended to complete this PR or if there were any impeding issues that you encountered.

There are a couple of other potential contributors that are eyeing this project and I was wondering if there was a missing interface for which this BP could not be completed or if it was just for personal reasons. Thank you!

Hey @valeriabarra hope you are doing well! In short, progress didn't stop because of any major limitations in the libceed or petsc libraries. But the qfunction for building the RHS "SetupMassRHS" and "Error" I believe aren't available so a workaround would have to be implemented which could be very slow, or an addition to the gallery of qfunctions, or someway to use the qfunctions used by the BPs, or a way to define a custom one in python. If there are interested contributors they're more than welcome to work on it. If no one picks it up, I'll start on it again and get the development environment setup on a computer I actually own. Cheers!

tylercollins5737 avatar Oct 09 '25 22:10 tylercollins5737

Yeah, since there are QFunctions that are not available via the gallery, you'd have to use the technique shown in this folder for ex3_volume.py (and associated files) to use a QFunction written in C.

jeremylt avatar Oct 10 '25 14:10 jeremylt

@jeremylt Cool, yeah that should do the trick.

tylercollins5737 avatar Oct 10 '25 16:10 tylercollins5737