libCEED
libCEED copied to clipboard
Enzyme in libCEED
We have been able to reproduce examples/solids/finite-strain-neo-hookean-initial-1.h with Enzyme where Enzyme computes dSdE (\partial S / \partial E) in deltaS = dSdE:deltaE which was previously derived analytically.
CC: @KennethEJansen @wsmoses
The changes seem fine, can you rebuild that pull request on Enzyme again, there were a few changes added which should ensure this works.
The changes seem fine, can you rebuild that pull request on Enzyme again, there were a few changes added which should ensure this works.
Indeed it did work! Thanks!
This is looking pretty good overall. This is marked draft. What's left before it's ready for review? I'd like to migrate it over to Ratel when this branch is ready.
I am trying to wrap this up but I am not able to compile it. Nothing has really changed since the last time that I was able to compile and run the code. @wsmoses , do you think I need to change anything in the implementation?
/libCEED/examples/solids $ make V=1
/home/leila/git/petsc/arch-clang/bin/mpicc -L/home/leila/git/petsc/arch-clang/lib -L/home/leila/git/libCEED/lib -Wl,-rpath,/home/leila/git/petsc/arch-clang/lib -Wl,-rpath,/home/leila/git/libCEED/lib build/elasticity.o build/problems/finite-strain-mooney-rivlin-initial-1.o build/problems/finite-strain-neo-hookean-current-1.o build/problems/finite-strain-neo-hookean-current-2.o build/problems/finite-strain-neo-hookean-initial-1.o build/problems/finite-strain-neo-hookean-initial-2.o build/problems/linear.o build/problems/mooney-rivlin.o build/problems/neo-hookean.o build/problems/problem-register.o build/problems/problem-weak.o build/problems/small-strain-neo-hookean.o build/src/boundary.o build/src/cl-options.o build/src/matops.o build/src/misc.o build/src/setup-dm.o build/src/setup-libceed.o build/problems/finite-strain-neo-hookean-initial-ad.o -lpetsc -lceed -lm -o elasticity
/usr/bin/ld: build/problems/finite-strain-neo-hookean-initial-ad.o: in function `getEnzymeSize':
/home/leila/git/libCEED/examples/solids/problems/../qfunctions/finite-strain-neo-hookean-initial-ad.h:179: undefined reference to `__enzyme_augmentsize'
/usr/bin/ld: build/problems/finite-strain-neo-hookean-initial-ad.o: in function `grad_S_fwd':
/home/leila/git/libCEED/examples/solids/problems/../qfunctions/finite-strain-neo-hookean-initial-ad.h:185: undefined reference to `__enzyme_augmentfwd'
/usr/bin/ld: build/problems/finite-strain-neo-hookean-initial-ad.o: in function `grad_S_rev':
/home/leila/git/libCEED/examples/solids/problems/../qfunctions/finite-strain-neo-hookean-initial-ad.h:193: undefined reference to `__enzyme_reverse'
/usr/bin/ld: /home/leila/git/libCEED/examples/solids/problems/../qfunctions/finite-strain-neo-hookean-initial-ad.h:197: undefined reference to `__enzyme_reverse'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:56: elasticity] Error 1
@LeilaGhaffari, this sounds pretty close to ready. I'd like to add this work to Ratel. It think it will take a bit of effort to adapt, but it shouldn't be too bad and it would be interesting to run this at a larger scale
@jeremylt , this works fine on CPU but the example runs for ever on HIP. I haven't figured out the problem yet.
Note - this branch needs the updates in main for the latest development version of PETSc: #940
Would you like to finish this branch or close it because the relevant code is in Ratel?
I think we decided to close this and migrate the remaining pieces to Ratel. I'll go ahead and close it but would like to keep the branch until it is completely moved to Ratel.