Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/remove-deprecated-code-t…
Browse files Browse the repository at this point in the history
…ypes' into feature/error-handling-just-the-core
  • Loading branch information
balos1 committed Nov 6, 2023
2 parents 7d21ea5 + 1212aea commit f136670
Show file tree
Hide file tree
Showing 789 changed files with 24,661 additions and 29,756 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# SUNDIALS Changelog

## Changes to SUNDIALS in release 7.0.0

The previously deprecated types `realtype` and `booleantype` were removed from `sundials_types.h`.
Users should use `sunrealtype` and `sunbooleantype` instead, but the old names for the types
can be used by including the header file `sundials_types_old.h`.


## Changes to SUNDIALS in release X.X.X

Expand Down Expand Up @@ -41,6 +47,7 @@ method `ARKODE_VERNER_16_8_9`.
Changed the `SUNProfiler` so that it does not rely on `MPI_WTime` in any case.
This fixes https://github.com/LLNL/sundials/issues/312.


## Changes to SUNDIALS in release 6.6.1

Updated the Tpetra NVector interface to support Trilinos 14.
Expand Down
48 changes: 24 additions & 24 deletions benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ using MemSpace = Kokkos::HostSpace;
using ExecSpace = Kokkos::Serial;
using MemSpace = Kokkos::HostSpace;
#endif
using Vec1D = Kokkos::View<realtype*, MemSpace>;
using Vec4D = Kokkos::View<realtype****, MemSpace>;
using Vec1D = Kokkos::View<sunrealtype*, MemSpace>;
using Vec4D = Kokkos::View<sunrealtype****, MemSpace>;
using Vec1DHost = Vec1D::HostMirror;
using Vec4DHost = Vec4D::HostMirror;
using Range3D = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<3>>;
Expand Down Expand Up @@ -84,8 +84,8 @@ class ParallelGrid
// [in] st - the stencil to use (see StencilType)
// [in] npxyz - the number of processors in each dimension; defaults to 0 which means MPI will choose
// [in] reorder - should MPI_Cart_create do process reordering to optimize or not; defaults to false (some MPI implementations ignore this)
ParallelGrid(MPI_Comm* comm, const realtype a[], const realtype b[], const GLOBALINT npts[],
int dof, BoundaryType bc, StencilType st, const realtype c,
ParallelGrid(MPI_Comm* comm, const sunrealtype a[], const sunrealtype b[], const GLOBALINT npts[],
int dof, BoundaryType bc, StencilType st, const sunrealtype c,
const int npxyz[] = nullptr, bool reorder = false)
: nx(1), ny(1), nz(1),
nxl(1), nyl(1), nzl(1),
Expand Down Expand Up @@ -130,7 +130,7 @@ class ParallelGrid
nx = npts[0];
ax = a[0];
bx = b[0];
dx = (bx-ax) / (realtype) nx;
dx = (bx-ax) / (sunrealtype) nx;
int is = nx*(coords[0])/npx;
int ie = nx*(coords[0]+1)/npx-1;
nxl = ie-is+1;
Expand All @@ -141,7 +141,7 @@ class ParallelGrid
ny = npts[1];
ay = a[1];
by = b[1];
dy = (by-ay) / (realtype) ny;
dy = (by-ay) / (sunrealtype) ny;
int js = ny*(coords[1])/npy;
int je = ny*(coords[1]+1)/npy-1;
nyl = je-js+1;
Expand All @@ -152,7 +152,7 @@ class ParallelGrid
nz = npts[2];
az = a[2];
bz = b[2];
dz = (bz-az) / (realtype) nz;
dz = (bz-az) / (sunrealtype) nz;
int ks = nz*(coords[2])/npz;
int ke = nz*(coords[2]+1)/npz-1;
nzl = ke-ks+1;
Expand Down Expand Up @@ -469,31 +469,31 @@ class ParallelGrid
return dof*nptsl();
}

realtype* GetRecvView(const std::string& direction)
sunrealtype* GetRecvView(const std::string& direction)
{
if (direction == "WEST")
{
return static_cast<realtype*>(Wrecv_.data());
return static_cast<sunrealtype*>(Wrecv_.data());
}
else if (direction == "EAST")
{
return static_cast<realtype*>(Erecv_.data());
return static_cast<sunrealtype*>(Erecv_.data());
}
else if (direction == "NORTH")
{
return static_cast<realtype*>(Nrecv_.data());
return static_cast<sunrealtype*>(Nrecv_.data());
}
else if (direction == "SOUTH")
{
return static_cast<realtype*>(Srecv_.data());
return static_cast<sunrealtype*>(Srecv_.data());
}
else if (direction == "FRONT")
{
return static_cast<realtype*>(Frecv_.data());
return static_cast<sunrealtype*>(Frecv_.data());
}
else if (direction == "BACK")
{
return static_cast<realtype*>(Brecv_.data());
return static_cast<sunrealtype*>(Brecv_.data());
}
else
{
Expand All @@ -502,31 +502,31 @@ class ParallelGrid
}
}

realtype* GetSendView(const std::string& direction)
sunrealtype* GetSendView(const std::string& direction)
{
if (direction == "WEST")
{
return static_cast<realtype*>(Wsend_.data());
return static_cast<sunrealtype*>(Wsend_.data());
}
else if (direction == "EAST")
{
return static_cast<realtype*>(Esend_.data());
return static_cast<sunrealtype*>(Esend_.data());
}
else if (direction == "NORTH")
{
return static_cast<realtype*>(Nsend_.data());
return static_cast<sunrealtype*>(Nsend_.data());
}
else if (direction == "SOUTH")
{
return static_cast<realtype*>(Ssend_.data());
return static_cast<sunrealtype*>(Ssend_.data());
}
else if (direction == "FRONT")
{
return static_cast<realtype*>(Fsend_.data());
return static_cast<sunrealtype*>(Fsend_.data());
}
else if (direction == "BACK")
{
return static_cast<realtype*>(Bsend_.data());
return static_cast<sunrealtype*>(Bsend_.data());
}
else
{
Expand All @@ -538,9 +538,9 @@ class ParallelGrid
GLOBALINT nx, ny, nz; /* number of intervals globally */
int nxl, nyl, nzl; /* number of intervals locally */
int npx, npy, npz; /* numner of processes */
realtype dx, dy, dz; /* mesh spacing */
realtype ax, ay, az; /* domain in [a, b] */
realtype bx, by, bz;
sunrealtype dx, dy, dz; /* mesh spacing */
sunrealtype ax, ay, az; /* domain in [a, b] */
sunrealtype bx, by, bz;
int dof; /* degrees of freedom per node */
int neq; /* total number of equations locally */

Expand Down
14 changes: 7 additions & 7 deletions benchmarks/advection_reaction_3D/kokkos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ listed below.
| `--nout <int>` | Number of output times | 40 |
| `--npts <int>` | Number of mesh points in each direction | 100 |
| `--npxyz <int> <int> <int>` | Number of MPI tasks in each direction (0 forces MPI to decide) | 0 0 0 |
| `--xmax <realtype>` | Maximum value of `x`, `y`, and `z` in :math:`X_max` | 1.0 |
| `--A <realtype>` | Constant concentration of species `A` | 1.0 |
| `--B <realtype>` | Constant concentration of species `B` | 3.5 |
| `--c <realtype>` | Advection speed `c` | 0.01 |
| `--xmax <sunrealtype>` | Maximum value of `x`, `y`, and `z` in :math:`X_max` | 1.0 |
| `--A <sunrealtype>` | Constant concentration of species `A` | 1.0 |
| `--B <sunrealtype>` | Constant concentration of species `B` | 3.5 |
| `--c <sunrealtype>` | Advection speed `c` | 0.01 |
| `--order <int>` | Integration method order | 3 |
| `--method <method>` | Integrator to use: `ERK`, `ARK-DIRK`, `ARK-IMEX`, `CV-BDF`, `CV-ADAMS`, `IDA` | `ARK-DIRK` |
| `--nls <method>` | Nonlinear Solver Method: `newton`, `tl-newton`, `fixedpoint`, `none` | `newton` |
| `--fpaccel <int>` | Number of fixed point acceleration vectors | 3 |
| `--nopre` | Disable preconditioning | False |
| `--fused` | Enabled fused operations | Off |
| `--tf <realtype>` | Final integration time `t_f` | 10.0 |
| `--rtol <realtype>` | Relative tolerance | 1.0e-6 |
| `--atol <realtype>` | Absolute tolerance | 1.0e-9 |
| `--tf <sunrealtype>` | Final integration time `t_f` | 10.0 |
| `--rtol <sunrealtype>` | Relative tolerance | 1.0e-6 |
| `--atol <sunrealtype>` | Absolute tolerance | 1.0e-9 |

## Building and Running

Expand Down
92 changes: 46 additions & 46 deletions benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
* --nopre turn off preconditioning
* --order <int> the method order to use
* --npts <int> number of mesh points in each direction
* --xmax <realtype> maximum value of x (size of domain)
* --tf <realtype> final time
* --A <realtype> A parameter value
* --B <realtype> B parameter value
* --k <realtype> reaction rate
* --c <realtype> advection speed
* --rtol <realtype> relative tolerance
* --atol <realtype> absolute tolerance
* --xmax <sunrealtype> maximum value of x (size of domain)
* --tf <sunrealtype> final time
* --A <sunrealtype> A parameter value
* --B <sunrealtype> B parameter value
* --k <sunrealtype> reaction rate
* --c <sunrealtype> advection speed
* --rtol <sunrealtype> relative tolerance
* --atol <sunrealtype> absolute tolerance
* --------------------------------------------------------------------------*/

#include "advection_reaction_3D.hpp"
Expand Down Expand Up @@ -167,7 +167,7 @@ int FillSendBuffers(N_Vector y, UserData* udata)
{

/* Shortcuts */
const realtype c = udata->c;
const sunrealtype c = udata->c;
const int nxl = udata->grid->nxl;
const int nyl = udata->grid->nyl;
const int nzl = udata->grid->nzl;
Expand Down Expand Up @@ -468,8 +468,8 @@ int SetupProblem(int argc, char *argv[], UserData* udata, UserOptions* uopt,

/* Setup the parallel decomposition */
const sunindextype npts[] = {uopt->npts, uopt->npts, uopt->npts};
const realtype amax[] = {0.0, 0.0, 0.0};
const realtype bmax[] = {udata->xmax, udata->xmax, udata->xmax};
const sunrealtype amax[] = {0.0, 0.0, 0.0};
const sunrealtype bmax[] = {udata->xmax, udata->xmax, udata->xmax};
udata->grid = new ParallelGrid<sunindextype>(&udata->comm, amax, bmax, npts,
3, BoundaryType::PERIODIC, StencilType::UPWIND, udata->c, uopt->npxyz);

Expand Down Expand Up @@ -551,15 +551,15 @@ int SetupProblem(int argc, char *argv[], UserData* udata, UserOptions* uopt,

/* Compute the 3D Gaussian function. */
KOKKOS_FUNCTION
void Gaussian3D(realtype& x, realtype& y, realtype& z, realtype xmax)
void Gaussian3D(sunrealtype& x, sunrealtype& y, sunrealtype& z, sunrealtype xmax)
{
/* Gaussian distribution defaults */
const realtype alpha = 0.1;
const realtype mu[] = { xmax/RCONST(2.0), xmax/RCONST(2.0), xmax/RCONST(2.0) };
const realtype sigma[] = { xmax/RCONST(4.0), xmax/RCONST(4.0), xmax/RCONST(4.0) }; // Sigma = diag(sigma)
const sunrealtype alpha = 0.1;
const sunrealtype mu[] = { xmax/SUN_RCONST(2.0), xmax/SUN_RCONST(2.0), xmax/SUN_RCONST(2.0) };
const sunrealtype sigma[] = { xmax/SUN_RCONST(4.0), xmax/SUN_RCONST(4.0), xmax/SUN_RCONST(4.0) }; // Sigma = diag(sigma)

/* denominator = 2*sqrt(|Sigma|*(2pi)^3) */
const realtype denom = 2.0 * sqrt((sigma[0]*sigma[1]*sigma[2])*pow(2*M_PI,3));
const sunrealtype denom = 2.0 * sqrt((sigma[0]*sigma[1]*sigma[2])*pow(2*M_PI,3));
x = alpha * exp( -((x - mu[0])*(x - mu[0])*(1.0/sigma[0])) / denom );
y = alpha * exp( -((y - mu[1])*(y - mu[1])*(1.0/sigma[1])) / denom );
z = alpha * exp( -((z - mu[2])*(z - mu[2])*(1.0/sigma[2])) / denom );
Expand All @@ -576,24 +576,24 @@ int SetIC(N_Vector y, UserData* udata)
const int nyl = udata->grid->nyl;
const int nzl = udata->grid->nzl;
const int dof = udata->grid->dof;
const realtype dx = udata->grid->dx;
const realtype dy = udata->grid->dy;
const realtype dz = udata->grid->dz;
const realtype xmax = udata->xmax;
const realtype A = udata->A;
const realtype B = udata->B;
const realtype k1 = udata->k1;
const realtype k2 = udata->k2;
const realtype k3 = udata->k3;
const realtype k4 = udata->k4;
const sunrealtype dx = udata->grid->dx;
const sunrealtype dy = udata->grid->dy;
const sunrealtype dz = udata->grid->dz;
const sunrealtype xmax = udata->xmax;
const sunrealtype A = udata->A;
const sunrealtype B = udata->B;
const sunrealtype k1 = udata->k1;
const sunrealtype k2 = udata->k2;
const sunrealtype k3 = udata->k3;
const sunrealtype k4 = udata->k4;
const int xcrd = udata->grid->coords[0];
const int ycrd = udata->grid->coords[1];
const int zcrd = udata->grid->coords[2];

/* Steady state solution */
const realtype us = k1 * A / k4;
const realtype vs = k2 * k4 * B / (k1 * k3 * A);
const realtype ws = 3.0;
const sunrealtype us = k1 * A / k4;
const sunrealtype vs = k2 * k4 * B / (k1 * k3 * A);
const sunrealtype ws = 3.0;

/* Create 4D view of y */
Vec4D yview(N_VGetDeviceArrayPointer(N_VGetLocalVector_MPIPlusX(y)), nxl, nyl, nzl, dof);
Expand All @@ -603,11 +603,11 @@ int SetIC(N_Vector y, UserData* udata)
Range3D({0,0,0},{nxl,nyl,nzl}),
KOKKOS_LAMBDA (int i, int j, int k)
{
realtype x = (xcrd * nxl + i) * dx;
realtype y = (ycrd * nyl + j) * dy;
realtype z = (zcrd * nzl + k) * dz;
sunrealtype x = (xcrd * nxl + i) * dx;
sunrealtype y = (ycrd * nyl + j) * dy;
sunrealtype z = (zcrd * nzl + k) * dz;
Gaussian3D(x,y,z,xmax);
const realtype p = x + y + z;
const sunrealtype p = x + y + z;
yview(i,j,k,0) = us + p;
yview(i,j,k,1) = vs + p;
yview(i,j,k,2) = ws + p;
Expand All @@ -619,17 +619,17 @@ int SetIC(N_Vector y, UserData* udata)


/* Write time and solution to disk */
int WriteOutput(realtype t, N_Vector y, UserData* udata, UserOptions* uopt)
int WriteOutput(sunrealtype t, N_Vector y, UserData* udata, UserOptions* uopt)
{
SUNDIALS_CXX_MARK_FUNCTION(udata->prof);

/* output current solution norm to screen */
realtype N = (realtype) udata->grid->npts();
realtype u = N_VWL2Norm(y, udata->umask);
sunrealtype N = (sunrealtype) udata->grid->npts();
sunrealtype u = N_VWL2Norm(y, udata->umask);
u = sqrt(u*u/N);
realtype v = N_VWL2Norm(y, udata->vmask);
sunrealtype v = N_VWL2Norm(y, udata->vmask);
v = sqrt(v*v/N);
realtype w = N_VWL2Norm(y, udata->wmask);
sunrealtype w = N_VWL2Norm(y, udata->wmask);
w = sqrt(w*w/N);
if (udata->myid == 0) {
printf(" %10.6f %10.6f %10.6f %10.6f\n", t, u, v, w);
Expand Down Expand Up @@ -697,14 +697,14 @@ void InputError(char *name)
fprintf(stderr, " --order <int> the method order to use\n");
fprintf(stderr, " --npts <int> number of mesh points in each direction\n");
fprintf(stderr, " --npxyz <int> <int> <int> number of processors in each direction (0 forces MPI to decide)\n");
fprintf(stderr, " --xmax <realtype> maximum value of x (size of domain)\n");
fprintf(stderr, " --tf <realtype> final time\n");
fprintf(stderr, " --A <realtype> A parameter value\n");
fprintf(stderr, " --B <realtype> B parameter value\n");
fprintf(stderr, " --k <realtype> reaction rate\n");
fprintf(stderr, " --c <realtype> advection speed\n");
fprintf(stderr, " --rtol <realtype> relative tolerance\n");
fprintf(stderr, " --atol <realtype> absolute tolerance\n");
fprintf(stderr, " --xmax <sunrealtype> maximum value of x (size of domain)\n");
fprintf(stderr, " --tf <sunrealtype> final time\n");
fprintf(stderr, " --A <sunrealtype> A parameter value\n");
fprintf(stderr, " --B <sunrealtype> B parameter value\n");
fprintf(stderr, " --k <sunrealtype> reaction rate\n");
fprintf(stderr, " --c <sunrealtype> advection speed\n");
fprintf(stderr, " --rtol <sunrealtype> relative tolerance\n");
fprintf(stderr, " --atol <sunrealtype> absolute tolerance\n");
}

MPI_Barrier(MPI_COMM_WORLD);
Expand Down
Loading

0 comments on commit f136670

Please sign in to comment.