Using SUNDIALS without ifdefs for CPU/GPU? #2557
Replies: 4 comments 8 replies
-
Hey Ben,
We're actually actively working on wrapping SUNDIALS time integrators in
amrex to make it easier for applications to call them.
Don Willcox is the one who can probably tell you the most ... we're all
just coming off our holiday break so hopefully he'll be able to answer in
the next day or two.
…On Mon, Jan 3, 2022 at 3:27 PM Ben Wibking ***@***.***> wrote:
I'd like to use SUNDIALS to integrate cooling source terms, very similar
to what is done in Nyx (but I need to add additional cooling terms for our
applications). I see a lot of ifdefs in the Nyx code that calls SUNDIALS
depending on whether CUDA is enabled or not. The example codes here
<https://github.com/AMReX-Codes/ATPESC-codes/tree/main/SUNDIALS%2BAMReX>
don't have explicit ifdefs, but maybe these examples are CPU-only.
Is there a wrapper available that hides the GPU details when using
SUNDIALS?
—
Reply to this email directly, view it on GitHub
<#2557>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACRE6YXCQ6MUTNJHOBJVFHTUUIWFHANCNFSM5LGGHCBA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Ann Almgren
Senior Scientist; Acting Dept Head, Applied Mathematics
Pronouns: she/her/hers
|
Beta Was this translation helpful? Give feedback.
-
Hi @BenWibking, Like @asalmgren said, I'm working on such a wrapper. Currently it supports only the ARKODE integrators in SUNDIALS and is designed to take a user-supplied function that computes a MultiFab to hold the right-hand-side for an ODE system. I haven't implemented the same sort of wrapper for CVODE, which is the implicit integrator Nyx uses, but I don't think that would be terribly difficult. So a couple of questions:
|
Beta Was this translation helpful? Give feedback.
-
also @BenWibking if you need fully implicit, and don't mind a zone-by-zone interface for the integrator, we have a C++ port of VODE that runs on GPUs that we use for reaction nets which are very stiff. It is in our Microphysics repo: |
Beta Was this translation helpful? Give feedback.
-
Mike types faster than I do....I was going to offer a similar capability via the combustion codes via https://github.com/AMReX-Combustion/PelePhysics The version here packs a bunch of cells from a MultiFab into a SUNDIALS vector and integrates over time using either CVODE or ARKCODE/ERKSTEP (suggesting a lot of code duplication between Castro, Nyx and Pele ..:) ) [templated interface]. Incidentally, I see that the MFEM group has nicely wrapped all the SUNDIALS functionality (at least to some fairly recent release date). I'll bet that their approach could be duplicated for AMReX applications with data from MultiFabs, then Pele/Castro/Nyx and this other app could use all the integrator options without duplicating even more code. Note however that the implicit solvers do introduce a bit more complexity associated with the Jacobians...might be too much and not worth it in your app. |
Beta Was this translation helpful? Give feedback.
-
I'd like to use SUNDIALS to integrate cooling source terms, very similar to what is done in Nyx (but I need to add additional cooling terms for our applications). I see a lot of ifdefs in the Nyx code that calls SUNDIALS depending on whether CUDA is enabled or not. The example codes here don't have explicit ifdefs, but maybe these examples are CPU-only.
Is there a wrapper available that hides the GPU details when using SUNDIALS?
Beta Was this translation helpful? Give feedback.
All reactions