Skip to content

Commit

Permalink
Merge branch 'develop' into feature/operator-splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
gardner48 authored Dec 6, 2024
2 parents a681934 + 924274f commit 2efd70f
Show file tree
Hide file tree
Showing 28 changed files with 80 additions and 76 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ inner stepper object, `ARKodeCreateMRIStepInnerStepper`.

### Bug Fixes

Fixed a bug where `CVodeSetProjFailEta` would ignore the `eta` parameter.

Fixed a bug in the SPTFQMR linear solver where recoverable preconditioner errors
were reported as unrecoverable.

Fixed a [bug](https://github.com/LLNL/sundials/issues/581) in the sparse matrix
implementation of `SUNMatScaleAddI` which caused out of bounds writes unless
`indexvals` were in ascending order for each row/column.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ int SetupProblem(int argc, char* argv[], UserData* udata, UserOptions* uopt,
uopt->fused = 0; /* use fused vector ops */
uopt->save = 1; /* save solution to disk */
uopt->nout = 10; /* number of output times */
uopt->outputdir = (char*)"."; /* output directory */
uopt->outputdir = "."; /* output directory */

/* Parse CLI args and set udata/uopt appropriately */
int retval = ParseArgs(argc, argv, udata, uopt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct UserOptions
int fused; /* use fused vector ops */
int nout; /* number of outputs */
int save; /* save solution to disk */
char* outputdir;
const char* outputdir;
};

/*
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/advection_reaction_3D/raja/arkode_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt)
long int nfe, nfi; /* RHS stats */
long int nni, ncnf; /* nonlinear solver stats */
long int nli, npsol; /* linear solver stats */
char fname[MXSTR];

/* Additively split methods should not add the advection and reaction terms */
udata->add_reactions = true;
Expand Down Expand Up @@ -248,7 +247,6 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt)
long int nfe, nfi; /* RHS stats */
long int nni, ncnf; /* nonlinear solver stats */
long int nli, npsol; /* linear solver stats */
char fname[MXSTR];

/* Additively split methods should not add the advection and reaction terms */
udata->add_reactions = false;
Expand Down Expand Up @@ -449,7 +447,6 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt)
int iout; /* output counter */
long int nst, nst_a, netf; /* step stats */
long int nfe; /* RHS stats */
char fname[MXSTR];

/* Additively split methods should not add the advection and reaction terms */
udata->add_reactions = true;
Expand Down
23 changes: 15 additions & 8 deletions cmake/SundialsSetupCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,33 @@ endif()
if(ENABLE_ALL_WARNINGS)
message(STATUS "Enabling all compiler warnings")

# Some warning flags are not supported by all compilers so ignore unknown
# flags with -Wno-unknown-warning-option. Ironically, this is not supported by
# some compilers.
set(WARNING_FLAGS
"-Wno-unknown-warning-option -Wall -Wpedantic -Wextra -Wshadow \
-Wwrite-strings -Wcast-align -Wdisabled-optimization -Wvla -Walloca \
-Wduplicated-cond -Wduplicated-branches")
# TODO(SBR): Try to add -Wredundant-decls once SuperLU version is updated in
# CI tests

# Avoid numerous warnings from printf
if(SUNDIALS_PRECISION MATCHES "EXTENDED")
set(CMAKE_C_FLAGS "-Wdouble-promotion ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wdouble-promotion ${CMAKE_CXX_FLAGS}")
set(WARNING_FLAGS "-Wdouble-promotion ${WARNING_FLAGS}")
endif()

if((SUNDIALS_PRECISION MATCHES "DOUBLE") AND (SUNDIALS_INDEX_SIZE MATCHES "32"
))
set(CMAKE_C_FLAGS "-Wconversion -Wno-sign-conversion ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wconversion -Wno-sign-conversion ${CMAKE_CXX_FLAGS}")
set(WARNING_FLAGS "-Wconversion -Wno-sign-conversion ${WARNING_FLAGS}")
endif()

# Avoid numerous warnings from SWIG generated functions
if(NOT BUILD_FORTRAN_MODULE_INTERFACE)
set(CMAKE_C_FLAGS "-Wmissing-declarations -Wcast-qual ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wmissing-declarations -Wcast-qual ${CMAKE_CXX_FLAGS}")
set(WARNING_FLAGS "-Wmissing-declarations -Wcast-qual ${WARNING_FLAGS}")
endif()

set(CMAKE_C_FLAGS "-Wall -Wpedantic -Wextra -Wshadow ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Wextra -Wshadow ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${WARNING_FLAGS} ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${WARNING_FLAGS} ${CMAKE_CXX_FLAGS}")

# TODO(DJG): Add -fcheck=all,no-pointer,no-recursion once Jenkins is updated
# to use gfortran > 5.5 which segfaults with -fcheck=array-temps,bounds,do,mem
Expand Down
6 changes: 6 additions & 0 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ inner stepper object, :c:func:`ARKodeCreateMRIStepInnerStepper`.

**Bug Fixes**

Fixed a bug where :c:func:`CVodeSetProjFailEta` would ignore the `eta`
parameter.

Fixed a bug in the SPTFQMR linear solver where recoverable preconditioner errors
were reported as unrecoverable.

Fixed a `bug <https://github.com/LLNL/sundials/issues/581>`__ in the sparse
matrix implementation of :c:func:`SUNMatScaleAddI` which caused out of bounds
writes unless ``indexvals`` were in ascending order for each row/column.
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/CXX_parallel/ark_brusselator1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct UserOptions
int nout; /* number of outputs */
int monitor; /* print solution to screen */
int printtime; /* print timing information */
char* outputdir;
const char* outputdir;
};

/*
Expand Down
25 changes: 12 additions & 13 deletions examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,6 @@ int TaskLocalNewton_GetNumConvFails(SUNNonlinearSolver NLS, long int* nconvfails

SUNNonlinearSolver TaskLocalNewton(SUNContext ctx, N_Vector y)
{
void* tmp_comm;
SUNNonlinearSolver NLS;
TaskLocalNewton_Content content;

Expand Down Expand Up @@ -1416,18 +1415,18 @@ int SetupProblem(int argc, char* argv[], UserData* udata, UserOptions* uopt,
udata->WFID = NULL;

/* set default integrator options */
uopt->order = 3; /* method order */
uopt->expl = 0; /* imex or explicit */
uopt->t0 = 0.0; /* initial time */
uopt->tf = 10.0; /* final time */
uopt->rtol = 1.0e-6; /* relative tolerance */
uopt->atol = 1.0e-9; /* absolute tolerance */
uopt->global = 0; /* use global NLS */
uopt->fused = 0; /* use fused vector ops */
uopt->monitor = 0; /* print solution to screen */
uopt->printtime = 0; /* print timing */
uopt->nout = 40; /* number of output times */
uopt->outputdir = (char*)"."; /* output directory */
uopt->order = 3; /* method order */
uopt->expl = 0; /* imex or explicit */
uopt->t0 = 0.0; /* initial time */
uopt->tf = 10.0; /* final time */
uopt->rtol = 1.0e-6; /* relative tolerance */
uopt->atol = 1.0e-9; /* absolute tolerance */
uopt->global = 0; /* use global NLS */
uopt->fused = 0; /* use fused vector ops */
uopt->monitor = 0; /* print solution to screen */
uopt->printtime = 0; /* print timing */
uopt->nout = 40; /* number of output times */
uopt->outputdir = "."; /* output directory */

/* check for input args */
if (argc > 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ typedef struct
FILE* UFID; /* solution output file pointer */
FILE* VFID;
FILE* WFID;
char* outputdir;
const char* outputdir;
}* UserOptions;

/*
Expand Down
4 changes: 2 additions & 2 deletions examples/cvodes/C_openmp/cvsAdvDiff_bnd_omp.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void PrintFinalStats(void* cvode_mem);

/* Private function to check function return values */

static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/* Functions Called by the Solver */

Expand Down Expand Up @@ -461,7 +461,7 @@ static void PrintFinalStats(void* cvode_mem)
opt == 2 means function allocates memory so check if returned
NULL pointer */

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/ida/C_openmp/idaFoodWeb_bnd_omp.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static void Fweb(sunrealtype tcalc, N_Vector cc, N_Vector crate,
static void WebRates(sunrealtype xx, sunrealtype yy, sunrealtype* cxy,
sunrealtype* ratesxy, UserData webdata);
static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2);
static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -726,7 +726,7 @@ static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2)
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/ida/C_openmp/idaFoodWeb_kry_omp.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static void Fweb(sunrealtype tcalc, N_Vector cc, N_Vector crate,
static void WebRates(sunrealtype xx, sunrealtype yy, sunrealtype* cxy,
sunrealtype* ratesxy, UserData webdata);
static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2);
static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -864,7 +864,7 @@ static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2)
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/ida/serial/idaFoodWeb_kry.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static void Fweb(sunrealtype tcalc, N_Vector cc, N_Vector crate,
static void WebRates(sunrealtype xx, sunrealtype yy, sunrealtype* cxy,
sunrealtype* ratesxy, UserData webdata);
static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2);
static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -823,7 +823,7 @@ static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2)
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/idas/C_openmp/idasFoodWeb_bnd_omp.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static void Fweb(sunrealtype tcalc, N_Vector cc, N_Vector crate,
static void WebRates(sunrealtype xx, sunrealtype yy, sunrealtype* cxy,
sunrealtype* ratesxy, UserData webdata);
static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2);
static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -727,7 +727,7 @@ static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2)
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/idas/C_openmp/idasFoodWeb_kry_omp.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static void Fweb(sunrealtype tcalc, N_Vector cc, N_Vector crate,
static void WebRates(sunrealtype xx, sunrealtype yy, sunrealtype* cxy,
sunrealtype* ratesxy, UserData webdata);
static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2);
static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -862,7 +862,7 @@ static sunrealtype dotprod(sunindextype size, sunrealtype* x1, sunrealtype* x2)
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/idas/serial/idasRoberts_ASAi_klu.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int rhsQB(sunrealtype tt, N_Vector yy, N_Vector yp, N_Vector yyB,
/* Prototypes of private functions */
static void PrintOutput(sunrealtype tfinal, N_Vector yB, N_Vector ypB,
N_Vector qB);
static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -808,7 +808,7 @@ static void PrintOutput(sunrealtype tfinal, N_Vector yB, N_Vector ypB, N_Vector
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/idas/serial/idasRoberts_ASAi_sps.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int rhsQB(sunrealtype tt, N_Vector yy, N_Vector yp, N_Vector yyB,
/* Prototypes of private functions */
static void PrintOutput(sunrealtype tfinal, N_Vector yB, N_Vector ypB,
N_Vector qB);
static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -809,7 +809,7 @@ static void PrintOutput(sunrealtype tfinal, N_Vector yB, N_Vector ypB, N_Vector
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/idas/serial/idasRoberts_FSA_klu.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void PrintSensOutput(N_Vector* uS);

static void PrintFinalStats(void* ida_mem, sunbooleantype sensi);

static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -840,7 +840,7 @@ static void PrintFinalStats(void* ida_mem, sunbooleantype sensi)
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
4 changes: 2 additions & 2 deletions examples/idas/serial/idasRoberts_FSA_sps.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void PrintSensOutput(N_Vector* uS);

static void PrintFinalStats(void* ida_mem, sunbooleantype sensi);

static int check_retval(void* returnvalue, char* funcname, int opt);
static int check_retval(void* returnvalue, const char* funcname, int opt);

/*
*--------------------------------------------------------------------
Expand Down Expand Up @@ -841,7 +841,7 @@ static void PrintFinalStats(void* ida_mem, sunbooleantype sensi)
* NULL pointer
*/

static int check_retval(void* returnvalue, char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
10 changes: 0 additions & 10 deletions src/arkode/arkode_arkstep_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,6 @@ int arkStep_NlsLSolve(N_Vector delta, void* arkode_mem);
int arkStep_NlsConvTest(SUNNonlinearSolver NLS, N_Vector y, N_Vector del,
sunrealtype tol, N_Vector ewt, void* arkode_mem);

/* private functions for interfacing with MRIStep */
int arkStep_SetInnerForcing(ARKodeMem arkode_mem, sunrealtype tshift,
sunrealtype tscale, N_Vector* f, int nvecs);
int arkStep_MRIStepInnerEvolve(MRIStepInnerStepper stepper, sunrealtype t0,
sunrealtype tout, N_Vector y);
int arkStep_MRIStepInnerFullRhs(MRIStepInnerStepper stepper, sunrealtype t,
N_Vector y, N_Vector f, int mode);
int arkStep_MRIStepInnerReset(MRIStepInnerStepper stepper, sunrealtype tR,
N_Vector yR);

/* private functions for relaxation */
int arkStep_SetRelaxFn(ARKodeMem ark_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac);
int arkStep_RelaxDeltaE(ARKodeMem ark_mem, ARKRelaxJacFn relax_jac_fn,
Expand Down
2 changes: 1 addition & 1 deletion src/arkode/arkode_ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj)
if (retval != ARK_SUCCESS) { return (retval); }

/* store input and return */
arkls_mem->msbj = (msbj <= ZERO) ? ARKLS_MSBJ : msbj;
arkls_mem->msbj = (msbj <= 0) ? ARKLS_MSBJ : msbj;

return (ARKLS_SUCCESS);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cvode/cvode_proj.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ int CVodeSetProjFailEta(void* cvode_mem, sunrealtype eta)
else
{
/* Update the eta value */
proj_mem->eta_pfail = PROJ_FAIL_ETA;
proj_mem->eta_pfail = eta;
}

return (CV_SUCCESS);
Expand Down
2 changes: 1 addition & 1 deletion src/cvodes/cvodes_proj.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ int CVodeSetProjFailEta(void* cvode_mem, sunrealtype eta)
else
{
/* Update the eta value */
proj_mem->eta_pfail = PROJ_FAIL_ETA;
proj_mem->eta_pfail = eta;
}

return (CV_SUCCESS);
Expand Down
2 changes: 1 addition & 1 deletion src/ida/ida.c
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,7 @@ static int IDAStep(IDAMem IDA_mem)
saved_t = IDA_mem->ida_tn;
ncf = nef = 0;

if (IDA_mem->ida_nst == ZERO)
if (IDA_mem->ida_nst == 0)
{
IDA_mem->ida_kk = 1;
IDA_mem->ida_kused = 0;
Expand Down
Loading

0 comments on commit 2efd70f

Please sign in to comment.