Skip to content

Commit

Permalink
fix for sundials compiled with mpi
Browse files Browse the repository at this point in the history
  • Loading branch information
gtheler committed Dec 27, 2024
1 parent 6201f62 commit e368573
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/math/dae.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,13 @@ int feenox_dae_init(void) {

int err = 0; // this is used inside the ida_call() macro
#if SUNDIALS_VERSION_MAJOR >= 6
#ifdef SUNDIALS_MPI_ENABLED
MPI_Init(NULL, NULL);
ida_call(SUNContext_Create(MPI_COMM_WORLD, &feenox.dae.ctx));
#else
ida_call(SUNContext_Create(NULL, &feenox.dae.ctx));
#endif

feenox_check_alloc(feenox.dae.x = N_VNew_Serial(feenox.dae.dimension, feenox.dae.ctx));
feenox_check_alloc(feenox.dae.dxdt = N_VNew_Serial(feenox.dae.dimension, feenox.dae.ctx));
feenox_check_alloc(feenox.dae.id = N_VNew_Serial(feenox.dae.dimension, feenox.dae.ctx));
Expand Down

0 comments on commit e368573

Please sign in to comment.