From baf96a30fc83f1cce83f61e183e51df19381d4f1 Mon Sep 17 00:00:00 2001 From: James Wright Date: Wed, 5 Apr 2023 12:13:24 -0600 Subject: [PATCH 1/3] fix: Update DMGetRegionDS calls in examples/petsc - Also update minimum required PETSc version - Update releasenotes with change to minimum PETSc version --- doc/sphinx/source/releasenotes.md | 6 ++++++ examples/petsc/include/petscversion.h | 4 ++-- examples/petsc/src/petscutils.c | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/sphinx/source/releasenotes.md b/doc/sphinx/source/releasenotes.md index 267cf8e01b..b9ffbac0fc 100644 --- a/doc/sphinx/source/releasenotes.md +++ b/doc/sphinx/source/releasenotes.md @@ -17,6 +17,12 @@ For example, `CeedOperatorContextGetFieldLabel` was renamed to `CeedOperatorGetC - Update `/cpu/self/memcheck/*` backends to help verify `CeedVector` array access assumptions and `CeedQFunction` user output assumptions. - Update {c:func}`CeedOperatorLinearAssembleDiagonal` to provide default implementation that supports `CeedOperator` with multiple active bases. +### Examples + +#### {ref}`example-petsc-bps` + +- Requires PETSc version >3.19 + (v0-11)= ## v0.11 (Dec 24, 2022) diff --git a/examples/petsc/include/petscversion.h b/examples/petsc/include/petscversion.h index 6d0e248459..45e9edfddb 100644 --- a/examples/petsc/include/petscversion.h +++ b/examples/petsc/include/petscversion.h @@ -1,8 +1,8 @@ #ifndef libceed_petsc_examples_version_h #define libceed_petsc_examples_version_h -#if PETSC_VERSION_LT(3, 17, 0) -#error "PETSc v3.17 or later is required" +#if PETSC_VERSION_LT(3, 19, 0) +#error "PETSc v3.19 or later is required" #endif #endif diff --git a/examples/petsc/src/petscutils.c b/examples/petsc/src/petscutils.c index f31d9eeb02..4220eaedf6 100644 --- a/examples/petsc/src/petscutils.c +++ b/examples/petsc/src/petscutils.c @@ -189,7 +189,7 @@ PetscErrorCode DMFieldToDSField(DM dm, DMLabel domain_label, PetscInt dm_field, PetscFunctionBeginUser; // Translate dm_field to ds_field - PetscCall(DMGetRegionDS(dm, domain_label, &field_is, &ds)); + PetscCall(DMGetRegionDS(dm, domain_label, &field_is, &ds, NULL)); PetscCall(ISGetIndices(field_is, &fields)); PetscCall(ISGetSize(field_is, &num_fields)); for (PetscInt i = 0; i < num_fields; i++) { @@ -316,7 +316,7 @@ PetscErrorCode CreateBasisFromPlex(Ceed ceed, DM dm, DMLabel domain_label, CeedI PetscFunctionBeginUser; // Get element information - PetscCall(DMGetRegionDS(dm, domain_label, NULL, &ds)); + PetscCall(DMGetRegionDS(dm, domain_label, NULL, &ds, NULL)); PetscCall(DMFieldToDSField(dm, domain_label, dm_field, &ds_field)); PetscCall(PetscDSGetDiscretization(ds, ds_field, (PetscObject *)&fe)); PetscCall(PetscFEGetHeightSubspace(fe, height, &fe)); From 1622892d59bb89b42aca0ae8762573a59f173bd3 Mon Sep 17 00:00:00 2001 From: James Wright Date: Fri, 7 Apr 2023 08:19:36 -0600 Subject: [PATCH 2/3] examples/petsc: Remove unneeded PETSC_VERSION_LT - We now require greater than 3.19 anyways Co-authored-by: Jeremy L Thompson --- doc/sphinx/source/releasenotes.md | 2 +- examples/petsc/area.c | 7 ------- examples/petsc/bps.c | 7 ------- examples/petsc/bpsraw.c | 7 ------- examples/petsc/bpssphere.c | 7 ------- examples/petsc/multigrid.c | 7 ------- 6 files changed, 1 insertion(+), 36 deletions(-) diff --git a/doc/sphinx/source/releasenotes.md b/doc/sphinx/source/releasenotes.md index b9ffbac0fc..988ac7e7d8 100644 --- a/doc/sphinx/source/releasenotes.md +++ b/doc/sphinx/source/releasenotes.md @@ -21,7 +21,7 @@ For example, `CeedOperatorContextGetFieldLabel` was renamed to `CeedOperatorGetC #### {ref}`example-petsc-bps` -- Requires PETSc version >3.19 +- Requires PETSc version 3.19 or later (v0-11)= diff --git a/examples/petsc/area.c b/examples/petsc/area.c index bb2d201246..c9d436a8c4 100644 --- a/examples/petsc/area.c +++ b/examples/petsc/area.c @@ -51,13 +51,6 @@ static const char help[] = "Compute surface area of a cube or a cubed-sphere usi #include "include/petscversion.h" #include "include/structs.h" -#if PETSC_VERSION_LT(3, 12, 0) -#ifdef PETSC_HAVE_CUDA -#include -// Note: With PETSc prior to version 3.12.0, providing the source path to include 'cublas_v2.h' will be needed to use 'petsccuda.h'. -#endif -#endif - #ifndef M_PI #define M_PI 3.14159265358979323846 #endif diff --git a/examples/petsc/bps.c b/examples/petsc/bps.c index 646d71f8f8..a46ee249a2 100644 --- a/examples/petsc/bps.c +++ b/examples/petsc/bps.c @@ -47,13 +47,6 @@ const char help[] = "Solve CEED BPs using PETSc with DMPlex\n"; #include "include/petscversion.h" #include "include/structs.h" -#if PETSC_VERSION_LT(3, 12, 0) -#ifdef PETSC_HAVE_CUDA -#include -// Note: With PETSc prior to version 3.12.0, providing the source path to include 'cublas_v2.h' will be needed to use 'petsccuda.h'. -#endif -#endif - // ----------------------------------------------------------------------------- // Main body of program, called in a loop for performance benchmarking purposes // ----------------------------------------------------------------------------- diff --git a/examples/petsc/bpsraw.c b/examples/petsc/bpsraw.c index a8e7b23084..081e9e24d0 100644 --- a/examples/petsc/bpsraw.c +++ b/examples/petsc/bpsraw.c @@ -43,13 +43,6 @@ const char help[] = "Solve CEED BPs using PETSc\n"; #include "qfunctions/bps/bp4.h" #include "qfunctions/bps/common.h" -#if PETSC_VERSION_LT(3, 12, 0) -#ifdef PETSC_HAVE_CUDA -#include -// Note: With PETSc prior to version 3.12.0, providing the source path to include 'cublas_v2.h' will be needed to use 'petsccuda.h'. -#endif -#endif - static CeedMemType MemTypeP2C(PetscMemType mem_type) { return PetscMemTypeDevice(mem_type) ? CEED_MEM_DEVICE : CEED_MEM_HOST; } static void Split3(PetscInt size, PetscInt m[3], bool reverse) { diff --git a/examples/petsc/bpssphere.c b/examples/petsc/bpssphere.c index a729c1d1f6..cb7b649a44 100644 --- a/examples/petsc/bpssphere.c +++ b/examples/petsc/bpssphere.c @@ -46,13 +46,6 @@ static const char help[] = "Solve CEED BPs on a sphere using DMPlex in PETSc\n"; #include "include/petscversion.h" #include "include/sphereproblemdata.h" -#if PETSC_VERSION_LT(3, 12, 0) -#ifdef PETSC_HAVE_CUDA -#include -// Note: With PETSc prior to version 3.12.0, providing the source path to include 'cublas_v2.h' will be needed to use 'petsccuda.h'. -#endif -#endif - int main(int argc, char **argv) { MPI_Comm comm; char ceed_resource[PETSC_MAX_PATH_LEN] = "/cpu/self", filename[PETSC_MAX_PATH_LEN]; diff --git a/examples/petsc/multigrid.c b/examples/petsc/multigrid.c index 2daee85d9a..ee529a0f0d 100644 --- a/examples/petsc/multigrid.c +++ b/examples/petsc/multigrid.c @@ -45,13 +45,6 @@ const char help[] = "Solve CEED BPs using p-multigrid with PETSc and DMPlex\n"; #include "include/petscversion.h" #include "include/structs.h" -#if PETSC_VERSION_LT(3, 12, 0) -#ifdef PETSC_HAVE_CUDA -#include -// Note: With PETSc prior to version 3.12.0, providing the source path to include 'cublas_v2.h' will be needed to use 'petsccuda.h'. -#endif -#endif - int main(int argc, char **argv) { MPI_Comm comm; char filename[PETSC_MAX_PATH_LEN], ceed_resource[PETSC_MAX_PATH_LEN] = "/cpu/self"; From db3e7f9263783431d5a059049e63867de3440125 Mon Sep 17 00:00:00 2001 From: James Wright Date: Fri, 7 Apr 2023 11:10:41 -0600 Subject: [PATCH 3/3] Update minimum petsc version for solids and fluids --- examples/fluids/navierstokes.h | 4 ++-- examples/solids/elasticity.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/fluids/navierstokes.h b/examples/fluids/navierstokes.h index 06f3c624a1..20b98fabe2 100644 --- a/examples/fluids/navierstokes.h +++ b/examples/fluids/navierstokes.h @@ -19,8 +19,8 @@ // ----------------------------------------------------------------------------- // PETSc Version // ----------------------------------------------------------------------------- -#if PETSC_VERSION_LT(3, 17, 0) -#error "PETSc v3.17 or later is required" +#if PETSC_VERSION_LT(3, 19, 0) +#error "PETSc v3.19 or later is required" #endif // ----------------------------------------------------------------------------- diff --git a/examples/solids/elasticity.h b/examples/solids/elasticity.h index de84b86bd1..40259eb222 100644 --- a/examples/solids/elasticity.h +++ b/examples/solids/elasticity.h @@ -23,8 +23,8 @@ #include "include/utils.h" #include "problems/problems.h" -#if PETSC_VERSION_LT(3, 17, 0) -#error "PETSc v3.17 or later is required" +#if PETSC_VERSION_LT(3, 19, 0) +#error "PETSc v3.19 or later is required" #endif #endif // libceed_solids_examples_setup_h