Skip to content

Commit

Permalink
Merge branch 'develop' into feature/test-all-tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven-Roberts committed May 21, 2024
2 parents 864d7e7 + cac4dbb commit 7190c1f
Show file tree
Hide file tree
Showing 108 changed files with 563 additions and 691 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
21 changes: 15 additions & 6 deletions .github/workflows/windows-latest-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,29 @@ jobs:
# Use MSYS2 as default shell
shell: msys2 {0}

strategy:
matrix:
msystem: [MINGW64, MINGW32]
include:
- msystem: MINGW64
target-prefix: mingw-w64-x86_64
- msystem: MINGW32
target-prefix: mingw-w64-i686

steps:
- uses: actions/checkout@v3

- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
msystem: ${{ matrix.msystem }}
update: true
release: false
install: >-
base-devel
mingw-w64-x86_64-cmake
mingw-w64-x86_64-cc
mingw-w64-x86_64-openblas
mingw-w64-x86_64-suitesparse
${{ matrix.target-prefix }}-cmake
${{ matrix.target-prefix }}-cc
${{ matrix.target-prefix }}-openblas
${{ matrix.target-prefix }}-suitesparse
- name: Configure CMake
# Configure CMake in a 'build' subdirectory
Expand All @@ -50,7 +59,7 @@ jobs:
-DENABLE_KLU=ON
- name: Build
# Build your program
# Build program
run: cmake --build ${GITHUB_WORKSPACE}/build

- name: Test
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ allocated.
Fix bug on LLP64 platforms (like Windows 64-bit) where `KLU_INDEXTYPE` could be
32 bits wide even if `SUNDIALS_INT64_T` is defined.

Check if size of `SuiteSparse_long` is 8 if the size of `sunindextype` is 8
when using KLU.

## Changes to SUNDIALS in release v7.0.0

### Major Feature
Expand Down
36 changes: 23 additions & 13 deletions benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class ParallelGrid
// [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 sunrealtype a[], const sunrealtype b[],
const GLOBALINT npts[], int dof, BoundaryType bc, StencilType st,
const sunrealtype c, const int npxyz[] = nullptr,
bool reorder = false)
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),
Expand All @@ -103,12 +103,12 @@ class ParallelGrid
bx(0.0),
by(0.0),
bz(0.0),
dof(dof),
dof(dof_),
upwindRight(true),
dims{0, 0, 0},
coords{0, 0, 0},
bc(bc),
st(st),
upwindRight(true)
bc(bc_),
st(st_)
{
assert(st == StencilType::UPWIND);

Expand All @@ -121,6 +121,10 @@ class ParallelGrid
}

int retval, nprocs;
#ifdef NDEBUG
// Suppress unused variable warning
((void)retval);
#endif
MPI_Comm_size(*comm, &nprocs);
retval = MPI_Dims_create(nprocs, 3, dims);
assert(retval == MPI_SUCCESS);
Expand Down Expand Up @@ -181,6 +185,12 @@ class ParallelGrid
// For all faces: allocate upwind exchange buffers.
void AllocateBuffersUpwind()
{
int retval;
#ifdef NDEBUG
// Suppress unused variable warning
((void)retval);
#endif

/* Allocate send/receive buffers and determine ID for communication West */
if (upwindRight)
{
Expand All @@ -196,7 +206,7 @@ class ParallelGrid
if ((coords[0] > 0) || (bc == BoundaryType::PERIODIC))
{
int nbcoords[] = {coords[0] - 1, coords[1], coords[2]};
int retval = MPI_Cart_rank(cart_comm, nbcoords, &ipW);
retval = MPI_Cart_rank(cart_comm, nbcoords, &ipW);
assert(retval == MPI_SUCCESS);
}

Expand All @@ -215,7 +225,7 @@ class ParallelGrid
if ((coords[0] < dims[0] - 1) || (bc == BoundaryType::PERIODIC))
{
int nbcoords[] = {coords[0] + 1, coords[1], coords[2]};
int retval = MPI_Cart_rank(cart_comm, nbcoords, &ipE);
retval = MPI_Cart_rank(cart_comm, nbcoords, &ipE);
assert(retval == MPI_SUCCESS);
}

Expand All @@ -234,7 +244,7 @@ class ParallelGrid
if ((coords[1] > 0) || (bc == BoundaryType::PERIODIC))
{
int nbcoords[] = {coords[0], coords[1] - 1, coords[2]};
int retval = MPI_Cart_rank(cart_comm, nbcoords, &ipS);
retval = MPI_Cart_rank(cart_comm, nbcoords, &ipS);
assert(retval == MPI_SUCCESS);
}

Expand All @@ -253,7 +263,7 @@ class ParallelGrid
if ((coords[1] < dims[1] - 1) || (bc == BoundaryType::PERIODIC))
{
int nbcoords[] = {coords[0], coords[1] + 1, coords[2]};
int retval = MPI_Cart_rank(cart_comm, nbcoords, &ipN);
retval = MPI_Cart_rank(cart_comm, nbcoords, &ipN);
assert(retval == MPI_SUCCESS);
}

Expand All @@ -272,7 +282,7 @@ class ParallelGrid
if ((coords[2] > 0) || (bc == BoundaryType::PERIODIC))
{
int nbcoords[] = {coords[0], coords[1], coords[2] - 1};
int retval = MPI_Cart_rank(cart_comm, nbcoords, &ipB);
retval = MPI_Cart_rank(cart_comm, nbcoords, &ipB);
assert(retval == MPI_SUCCESS);
}

Expand All @@ -291,7 +301,7 @@ class ParallelGrid
if ((coords[2] < dims[2] - 1) || (bc == BoundaryType::PERIODIC))
{
int nbcoords[] = {coords[0], coords[1], coords[2] + 1};
int retval = MPI_Cart_rank(cart_comm, nbcoords, &ipF);
retval = MPI_Cart_rank(cart_comm, nbcoords, &ipF);
assert(retval == MPI_SUCCESS);
}
}
Expand Down
25 changes: 13 additions & 12 deletions benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int main(int argc, char* argv[])
if (udata.myid == 0 && uopt.nout > 0)
{
char fname[MXSTR];
snprintf(fname, MXSTR, "%s/mesh.txt", uopt.outputdir);
snprintf(fname, MXSTR, "%s/mesh.txt", uopt.outputdir.c_str());
udata.grid->MeshToFile(fname);
}

Expand Down Expand Up @@ -259,7 +259,7 @@ int FillSendBuffers(N_Vector y, UserData* udata)
* --------------------------------------------------------------*/

/* Parses the CLI arguments */
int ParseArgs(int argc, char* argv[], UserData* udata, UserOptions* uopt)
static int ParseArgs(int argc, char* argv[], UserData* udata, UserOptions* uopt)
{
/* check for input args */
if (argc > 1)
Expand Down Expand Up @@ -449,7 +449,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 Expand Up @@ -493,17 +493,17 @@ int SetupProblem(int argc, char* argv[], UserData* udata, UserOptions* uopt,
char fname[MXSTR];
if (udata->myid == 0)
{
sprintf(fname, "%s/t.%06d.txt", uopt->outputdir, udata->myid);
sprintf(fname, "%s/t.%06d.txt", uopt->outputdir.c_str(), udata->myid);
udata->TFID = fopen(fname, "w");
}

sprintf(fname, "%s/u.%06d.txt", uopt->outputdir, udata->myid);
sprintf(fname, "%s/u.%06d.txt", uopt->outputdir.c_str(), udata->myid);
udata->UFID = fopen(fname, "w");

sprintf(fname, "%s/v.%06d.txt", uopt->outputdir, udata->myid);
sprintf(fname, "%s/v.%06d.txt", uopt->outputdir.c_str(), udata->myid);
udata->VFID = fopen(fname, "w");

sprintf(fname, "%s/w.%06d.txt", uopt->outputdir, udata->myid);
sprintf(fname, "%s/w.%06d.txt", uopt->outputdir.c_str(), udata->myid);
udata->WFID = fopen(fname, "w");
}

Expand Down Expand Up @@ -540,7 +540,7 @@ int SetupProblem(int argc, char* argv[], UserData* udata, UserOptions* uopt,
printf(" reltol = %.1e\n", uopt->rtol);
printf(" abstol = %.1e\n", uopt->atol);
printf(" nout = %d\n", uopt->nout);
printf("Output directory: %s\n", uopt->outputdir);
printf("Output directory: %s\n", uopt->outputdir.c_str());
}

/* return success */
Expand All @@ -549,7 +549,8 @@ int SetupProblem(int argc, char* argv[], UserData* udata, UserOptions* uopt,

/* Compute the 3D Gaussian function. */
KOKKOS_FUNCTION
void Gaussian3D(sunrealtype& x, sunrealtype& y, sunrealtype& z, sunrealtype xmax)
static void Gaussian3D(sunrealtype& x, sunrealtype& y, sunrealtype& z,
sunrealtype xmax)
{
/* Gaussian distribution defaults */
const sunrealtype alpha = 0.1;
Expand All @@ -567,7 +568,7 @@ void Gaussian3D(sunrealtype& x, sunrealtype& y, sunrealtype& z, sunrealtype xmax
}

/* Initial condition function */
int SetIC(N_Vector y, UserData* udata)
int SetIC(N_Vector yvec, UserData* udata)
{
SUNDIALS_CXX_MARK_FUNCTION(udata->prof);

Expand Down Expand Up @@ -596,8 +597,8 @@ int SetIC(N_Vector y, UserData* udata)
const sunrealtype ws = 3.0;

/* Create 4D view of y */
Vec4D yview(N_VGetDeviceArrayPointer(N_VGetLocalVector_MPIPlusX(y)), nxl, nyl,
nzl, dof);
Vec4D yview(N_VGetDeviceArrayPointer(N_VGetLocalVector_MPIPlusX(yvec)), nxl,
nyl, nzl, dof);

/* Gaussian perturbation of the steady state solution */
Kokkos::parallel_for(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct UserOptions
int fused; /* use fused vector ops */
int nout; /* number of outputs */
int save; /* save solution to disk */
char* outputdir;
string outputdir;
};

/*
Expand Down Expand Up @@ -113,16 +113,16 @@ struct UserData
UserOptions* uopt;

/* Constructor that takes the context */
UserData(SUNContext ctx)
: ctx(ctx),
umask(nullptr),
vmask(nullptr),
wmask(nullptr),
uopt(nullptr),
UserData(SUNContext ctx_)
: ctx(ctx_),
TFID(nullptr),
UFID(nullptr),
VFID(nullptr),
WFID(nullptr)
WFID(nullptr),
umask(nullptr),
vmask(nullptr),
wmask(nullptr),
uopt(nullptr)
{
SUNContext_GetProfiler(ctx, &prof);
}
Expand Down
Loading

0 comments on commit 7190c1f

Please sign in to comment.