Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[sundials-users] Support for custom allocation strategies

23 views
Skip to first unread message

Brady, Peter T

unread,
Jul 17, 2024, 12:09:44 AM7/17/24
to SUNDIAL...@listserv.llnl.gov

Hi,

 

I am currently working on an application and was hoping to access some of the cvode functionality by wrapping our state vector implementation in the N_Vector interface described here: https://sundials.readthedocs.io/en/latest/nvectors/NVector_API_link.html.  The only problem I see is with the `clone` functionality.  We _cannot_ allocate new memory for state vectors after our initialization has completed.  Is there a way to query how many N_Vector’s would be needed by a cvode RK solver so I can allocate all the necessary memory upfront?

 

I apologize if this is spelled out in the docs and I missed it.

 

Thanks,

Peter.

-- 

Peter Brady, PhD.

Scientist

Computational Physics and Methods Group

Los Alamos National Laboratory



To unsubscribe from the SUNDIALS-USERS list: write to: mailto:SUNDIALS-USERS-...@LISTSERV.LLNL.GOV

Balos, Cody

unread,
Jul 17, 2024, 12:34:14 AM7/17/24
to SUNDIAL...@listserv.llnl.gov

Hi Peter,

 

There is not currently a way to query how many N_Vector’s will be needed.  One reason is because of the adaptation of the method order. You could come up with an upper bound for the number. If you want this to be as tight as possible, you will need to pin down the method (Adams or BDF), the nonlinear solver, and linear solver. Other CVODE options may impact the bound as well.  We could certainly advise on this estimate with more information about your configuration.

 

Then the question becomes how to do something with that information to solve your problem. Since you are writing your own N_Vector implementation, you could simply create a pool of N_Vector’s before your initialization completes, then in the N_VClone operation pull from this pool.  Alternatively, you could leverage the SUNMemoryHelper API (see https://sundials.readthedocs.io/en/latest/sunmemory/index.html).  Although, the SUNMemoryHelper is primarily useful if you are using one of the SUNDIALS-provided N_Vector implementations.

 

Regards,

Cody

 

-- 

 

Cody Balos

Computational Scientist

Center for Applied Scientific Computing

Lawrence Livermore National Laboratory

Brady, Peter T

unread,
Jul 18, 2024, 9:45:43 AM7/18/24
to SUNDIAL...@listserv.llnl.gov

Thanks Cody,

 

I can over allocate and play around with different settings to get an idea for how many instances we’ll typically need.  I’ve only just started looking into sundials so I’m not sure about the details of the CVODE configurations we’ll be using.

 

Thanks,

Peter.

Alan C. Hindmarsh

unread,
Jul 18, 2024, 9:46:35 AM7/18/24
to SUNDIAL...@listserv.llnl.gov
Hello Peter-

Did you mean "cvode solver" or arkode"  CVODE is not RK.

-Alan H

On 7/16/24 2:59 PM, Brady, Peter T wrote:
> Hi,
>
> I am currently working on an application and was hoping to access some of the cvode functionality by wrapping our state vector implementation in the N_Vector interface described here: https://urldefense.us/v3/__https://sundials.readthedocs.io/en/latest/nvectors/NVector_API_link.html__;!!G2kpM7uM-TzIFchu!zWV4-I6pIDnec8PMme2ys1uDmt2sg9zE8A5rVf107oaRW2hA2VInybsyht6ep80UtZQXpcyMLiP70YGzuA$ . The only problem I see is with the `clone` functionality. We _cannot_ allocate new memory for state vectors after our initialization has completed. Is there a way to query how many N_Vector’s would be needed by a cvode RK solver so I can allocate all the necessary memory upfront?
>
> I apologize if this is spelled out in the docs and I missed it.
>
> Thanks,
> Peter.
> --
> Peter Brady, PhD.
> Scientist
> Computational Physics and Methods Group
> Los Alamos National Laboratory
>
> ############################
>
> To unsubscribe from the SUNDIALS-USERS list:
> write to: mailto:SUNDIALS-USERS-...@LISTSERV.LLNL.GOV
>

############################

Balos, Cody

unread,
Jul 22, 2024, 11:54:49 AM7/22/24
to SUNDIAL...@listserv.llnl.gov

Forwarding this to the mailing list as it never went through due to the IT outage on Friday.

 

On 7/18/24, 7:08AM, "Brady, Peter T" <p...@lanl.gov> wrote:

At the moment I'm looking to leverage an IMEX solver which I thought was part of cvode.  I haven't spent too much time looking at things beyond the N_Vector docs so I may have gotten things wrong.  Does arkode have a way to query how many N_Vector's would be needed?

 

Peter.

 

On 7/18/24, 8:47 AM, "sundial...@llnl.gov <mailto:sundial...@llnl.gov> on behalf of Alan C. Hindmarsh" <sundial...@llnl.gov <mailto:sundial...@llnl.gov> on behalf of hindm...@LLNL.GOV <mailto:hindm...@LLNL.GOV>> wrote:

 

 

Hello Peter-

 

 

Did you mean "cvode solver" or arkode" CVODE is not RK.

 

 

-Alan H

 

 

On 7/16/24 2:59 PM, Brady, Peter T wrote:

> Hi,

> 

> I am currently working on an application and was hoping to access some of the cvode functionality by wrapping our state vector implementation in the N_Vector interface described here: https://urldefense.us/v2/url?u=https-3A__urldefense.com_v3_-5F-5Fhttps-3A__urldefense.us_v3_-5F-5Fhttps-3A_&d=DwIGaQ&c=pKoAVQro6qDbLoK0T8588B4mZJhJhC4e6QXJy0XnJec&r=IsYViwUmds7cOVRAnK5FQuZWxzbFgoQdevQXOdzqTvQ&m=15THSLfrPVTnF4vLKr163LUQaPMrpsTihSXGv1BM-fWY1BMuxbJrvcsOPDGUwY4u&s=wcAL3wUDWV1HA_CsMhmcRmazjRo9_2Ff3TybD1A97Ok&e=  <https://urldefense.us/v2/url?u=https-3A__urldefense.com_v3_-5F-5Fhttps-3A__urldefense.us_v3_-5F-5Fhttps-3A_&d=DwIGaQ&c=pKoAVQro6qDbLoK0T8588B4mZJhJhC4e6QXJy0XnJec&r=IsYViwUmds7cOVRAnK5FQuZWxzbFgoQdevQXOdzqTvQ&m=15THSLfrPVTnF4vLKr163LUQaPMrpsTihSXGv1BM-fWY1BMuxbJrvcsOPDGUwY4u&s=wcAL3wUDWV1HA_CsMhmcRmazjRo9_2Ff3TybD1A97Ok&e= >*sundials.readthedocs.io/en/latest/nvectors/NVector_API_link.html__;!!G2kpM7uM-TzIFchu!zWV4-I6pIDnec8PMme2ys1uDmt2sg9zE8A5rVf107oaRW2hA2VInybsyht6ep80UtZQXpcyMLiP70YGzuA$__;Lw!!Bt8fGhp8LhKGRg!B9yJA8ZA8LXiwYoVgqPqDq_5ZRLnCuxeHsU-_l3JEAmgnyTRV7kdyluLgOdNu-wp2kEAxP6mltT9KZOPckk$ . The only problem I see is with the `clone` functionality. We _cannot_ allocate new memory for state vectors after our initialization has completed. Is there a way to query how many N_Vector’s would be needed by a cvode RK solver so I can allocate all the necessary memory upfront?

> 

> I apologize if this is spelled out in the docs and I missed it.

> 

> Thanks,

> Peter.

> --

> Peter Brady, PhD.

> Scientist

> Computational Physics and Methods Group

> Los Alamos National Laboratory

> 

> ############################

> 

> To unsubscribe from the SUNDIALS-USERS list:

> 

 

 

############################

 

 

To unsubscribe from the SUNDIALS-USERS list:

 

  ############################

 

  To unsubscribe from the SUNDIALS-USERS list:

 

Balos, Cody

unread,
Jul 22, 2024, 12:16:47 PM7/22/24
to SUNDIAL...@listserv.llnl.gov

Hi Peter,

 

Indeed, the IMEX methods in SUNDIALS are Runge-Kutta methods and are in the ARKODE package, not CVODE.  ARKODE does not have a way to query the number of N_Vectors, but I believe a colleague has a separate script that can output the number based on answers to a few questions.

 

Cody

 

From: sundials-users <sundial...@llnl.gov> on behalf of Balos, Cody <bal...@llnl.gov>
Date: Monday, July 22, 2024 at 8:54

AM

Reply all
Reply to author
Forward
0 new messages