Skip to content

Commit

Permalink
Merge pull request #2189 from mfem/mfem-4.3-dev
Browse files Browse the repository at this point in the history
Final changes for mfem-4.3
  • Loading branch information
tzanio committed Jul 29, 2021
2 parents 378b658 + 6f493e7 commit 9d8043b
Show file tree
Hide file tree
Showing 33 changed files with 341 additions and 300 deletions.
377 changes: 195 additions & 182 deletions CHANGELOG

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(USER_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/config/user.cmake" CACHE PATH

# Require C++11 and disable compiler-specific extensions
set(CMAKE_CXX_STANDARD 11)
if (MFEM_USE_GINKGO)
if (MFEM_USE_GINKGO)
set(CMAKE_CXX_STANDARD 14)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -54,7 +54,7 @@ project(mfem NONE)
# Current version of MFEM, see also `makefile`.
# mfem_VERSION = (string)
# MFEM_VERSION = (int) [automatically derived from mfem_VERSION]
set(${PROJECT_NAME}_VERSION 4.2.1)
set(${PROJECT_NAME}_VERSION 4.3.0)

# Prohibit in-source build
if (${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
Expand Down Expand Up @@ -102,7 +102,7 @@ if (MFEM_USE_CUDA)
endif()
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 11)
if (MFEM_USE_GINKGO)
if (MFEM_USE_GINKGO)
set(CMAKE_CUDA_STANDARD 14)
endif()
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -246,6 +246,7 @@ if (MFEM_USE_OPENMP OR MFEM_USE_LEGACY_OPENMP)
message(FATAL_ERROR " *** MFEM_USE_LEGACY_OPENMP requires MFEM_THREAD_SAFE=ON.")
endif()
find_package(OpenMP REQUIRED)
set(OPENMP_LIBRARIES ${OpenMP_CXX_LIBRARIES})
endif()

# SuiteSparse (before SUNDIALS which may depend on KLU)
Expand Down Expand Up @@ -450,6 +451,9 @@ include_directories(${TPL_INCLUDE_DIRS})
if (OPENMP_FOUND)
message(STATUS "MFEM: using package OpenMP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
if (MFEM_USE_CUDA)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=${OpenMP_CXX_FLAGS}")
endif()
endif()

message(STATUS "MFEM build type: CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ The MFEM source code has the following structure:
.
├── config
│ ├── cmake
│ │ └── ...
│ └── githooks
├── data
├── doc
Expand Down Expand Up @@ -135,10 +134,10 @@ The MFEM source code has the following structure:
└── tests
├── convergence
├── gitlab
├── mem_manager
├── par-mesh-format
├── scripts
└── unit
└── ...
```

#### Main directories and classes
Expand Down
8 changes: 4 additions & 4 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ MFEM_USE_HIP = YES/NO
Enables support for AMD devices in MFEM. HIP is a heterogeneous-compute
interface for portability developed by AMD that can target both AMD and
NVIDIA GPUs. The variable HIP_ARCH is used to specify the AMD GPU processor
used during compilation (by default, HIP_ARCH=gfx900). When enabled, this
used during compilation (by default, HIP_ARCH=gfx900). When enabled, this
option uses the HIP_* build options, see below.

MFEM_USE_RAJA = YES/NO
Expand Down Expand Up @@ -623,7 +623,7 @@ The specific libraries and their options are:
and dependencies of specific modules, see the Ginkgo webpage below.
URL: https://ginkgo-project.github.io
Options: GINKGO_OPT, GINKGO_LIB, GINKGO_DIR, GINKGO_BUILD_TYPE (Release or Debug).
Versions: Ginkgo >= 1.4.0.
Versions: Ginkgo >= 1.4.0.

- AmgX (optional), used when MFEM_USE_AMGX = YES.
URL: https://github.com/NVIDIA/AMGX
Expand Down Expand Up @@ -970,15 +970,15 @@ config/config.hpp.in:

cp config/config.hpp.in config/_config.hpp

The file config/_config.hpp can then be edited to enable desired options. The
The file config/_config.hpp can then be edited to enable desired options. The
MFEM library is simply a combination of all object files obtained by compiling
the .cpp source files in the source directories: general, linalg, mesh, and fem.


Specifying an MPI job launcher
==============================
By default, MFEM will use 'mpirun -np #' to launch any of its parallel tests or
miniapps, where # is the number of MPI tasks. An alternate MPI launcher can be
miniapps, where # is the number of MPI tasks. An alternate MPI launcher can be
provided by setting the MFEM_MPIEXEC and MFEM_MPIEXEC_NP config variables.

MFEM will expect the launcher command, plus the command line option to allow it
Expand Down
4 changes: 2 additions & 2 deletions config/defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ set(MUMPS_DIR "${MFEM_DIR}/../MUMPS_5.2.0" CACHE PATH
"Path to the MUMPS library.")
# Packages required by MUMPS, depending on how it was compiled.
set(MUMPS_REQUIRED_PACKAGES "MPI" "BLAS" "METIS" "ScaLAPACK" CACHE STRING
"Additional packages required by MUMPS.")
"Additional packages required by MUMPS.")
# If the MPI package does not find all required Fortran libraries:
# set(MUMPS_REQUIRED_LIBRARIES "gfortran" "mpi_mpifh" CACHE STRING
# "Additional libraries required by MUMPS.")
# "Additional libraries required by MUMPS.")

set(STRUMPACK_DIR "${MFEM_DIR}/../STRUMPACK-build" CACHE PATH
"Path to the STRUMPACK library.")
Expand Down
2 changes: 1 addition & 1 deletion doc/CodeDocumentation.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "MFEM"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v4.2.1
PROJECT_NUMBER = v4.3.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if (MFEM_TEST_DEVICE)
if (NOT (${TEST_NAME} MATCHES ".*p$"))
add_test(NAME ${TEST_NAME}_${MFEM_TEST_DEVICE}_ser
COMMAND ${TEST_NAME} ${THIS_TEST_OPTIONS})
else()
elseif (MFEM_USE_MPI)
add_test(NAME ${TEST_NAME}_${MFEM_TEST_DEVICE}_np=${MFEM_MPI_NP}
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MFEM_MPI_NP}
${MPIEXEC_PREFLAGS}
Expand Down
18 changes: 18 additions & 0 deletions examples/caliper/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Finite Element Discretization Library
__
_ __ ___ / _| ___ _ __ ___
| '_ ` _ \ | |_ / _ \| '_ ` _ \
| | | | | || _|| __/| | | | | |
|_| |_| |_||_| \___||_| |_| |_|

https://mfem.org

This directory contains modifications of the example codes that illustrate the
use of MFEM features based on the Caliper performance profiling library.

To build these examples, make sure that MFEM is configured with the option
"MFEM_USE_CALIPER = YES", see the top-level INSTALL file for details (version
2.5.0 of Caliper is recommended, though older versions may work too).

We recommend comparing the original example codes with the corresponding files
in the current directory.
6 changes: 3 additions & 3 deletions fem/bilininteg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ class MixedScalarDerivativeIntegrator : public MixedScalarIntegrator
{
return "MixedScalarDerivativeIntegrator: "
"Trial and test spaces must both be scalar fields in 1D "
"and the trial space must implement CaldDShape.";
"and the trial space must implement CalcDShape.";
}

inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
Expand Down Expand Up @@ -2936,11 +2936,11 @@ class DGDiffusionIntegrator : public BilinearFormIntegrator
- F. Bassi and S. Rebay. A high order discontinuous Galerkin method for
compressible turbulent flows. In B. Cockburn, G. E. Karniadakis, and
C.-W. Shu, editors, Discontinuous Galerkin Methods, pages 7788. Springer
C.-W. Shu, editors, Discontinuous Galerkin Methods, pages 77-88. Springer
Berlin Heidelberg, 2000.
- D. N. Arnold, F. Brezzi, B. Cockburn, and L. D. Marini. Unified analysis
of discontinuous Galerkin methods for elliptic problems. SIAM Journal on
Numerical Analysis, 39(5):17491779, 2002.
Numerical Analysis, 39(5):1749-1779, 2002.
*/
class DGDiffusionBR2Integrator : public BilinearFormIntegrator
{
Expand Down
2 changes: 1 addition & 1 deletion fem/eltrans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class InverseElementTransformation

/// Set the desired print level, useful for debugging.
/** The valid options are: -1 - never print (default); 0 - print only errors;
1 - print the first and last last iterations; 2 - print every iteration;
1 - print the first and last iterations; 2 - print every iteration;
and 3 - print every iteration including point coordinates. */
void SetPrintLevel(int pr_level) { print_level = pr_level; }

Expand Down
4 changes: 2 additions & 2 deletions fem/fe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BasisType
{
"Gauss-Legendre", "Gauss-Lobatto", "Positive (Bernstein)",
"Open uniform", "Closed uniform", "Open half uniform",
"Seredipity", "Closed Gauss-Legendre",
"Serendipity", "Closed Gauss-Legendre",
"Integrated Gauss-Lobatto indicator"
};
return name[Check(b_type)];
Expand Down Expand Up @@ -1126,7 +1126,7 @@ class P1OnQuadFiniteElement : public NodalFiniteElement
{ dofs = 1.0; }
};

/// A 1D quadractic finite element with uniformly spaced nodes
/// A 1D quadratic finite element with uniformly spaced nodes
class Quad1DFiniteElement : public NodalFiniteElement
{
public:
Expand Down
2 changes: 1 addition & 1 deletion fem/nonlininteg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class NonlinearFormIntegrator
@param[in,out] y The result Vector: @f$ y += G x @f$. */
virtual void AddMultGradPA(const Vector &x, Vector &y) const;

/// Method for computing the diagonal of the gradient with partial assmebly.
/// Method for computing the diagonal of the gradient with partial assembly.
/** The result Vector @a diag is an E-Vector. This method can be called only
after the method AssembleGradPA() has been called.
Expand Down
2 changes: 1 addition & 1 deletion fem/pfespace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class ParFiniteElementSpace : public FiniteElementSpace
/** Returns pointer to the FiniteElement in the FiniteElementCollection
associated with i'th element in the mesh object. If @a i is greater than
or equal to the number of local mesh elements, @a i will be interpreted
as a shifted index of a face neigbor element. */
as a shifted index of a face neighbor element. */
virtual const FiniteElement *GetFE(int i) const;

/** Returns an Operator that converts L-vectors to E-vectors on each face.
Expand Down
4 changes: 0 additions & 4 deletions general/mem_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,10 +1377,6 @@ void MemoryManager::EraseDevice(void *h_ptr)
if (!h_ptr) { return; }
auto mem_map_iter = maps->memories.find(h_ptr);
if (mem_map_iter == maps->memories.end()) { mfem_error("Unknown pointer!"); }
if (maps->aliases.find(h_ptr) != maps->aliases.end())
{
mfem_error("cannot delete aliased obj!");
}
internal::Memory &mem = mem_map_iter->second;
if (mem.d_ptr) { ctrl->Device(mem.d_mt)->Dealloc(mem);}
mem.d_ptr = nullptr;
Expand Down
27 changes: 16 additions & 11 deletions linalg/hypre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ void HypreParMatrix::Read(MemoryClass mc) const
offd->i = const_cast<HYPRE_Int*>(mem_offd.I.Read(mc, num_rows+1));
offd->j = const_cast<HYPRE_Int*>(mem_offd.J.Read(mc, offd_nnz));
offd->data = const_cast<double*>(mem_offd.data.Read(mc, offd_nnz));
#if MFEM_HYPRE_VERSION >= 21400
HYPRE_MemoryLocation ml = (mc != GetHypreMemoryClass()
? HYPRE_MEMORY_HOST : HYPRE_MEMORY_DEVICE);
#if MFEM_HYPRE_VERSION >= 21800
decltype(diag->memory_location) ml =
(mc != GetHypreMemoryClass() ? HYPRE_MEMORY_HOST : HYPRE_MEMORY_DEVICE);
diag->memory_location = ml;
offd->memory_location = ml;
#endif
Expand All @@ -469,9 +469,9 @@ void HypreParMatrix::ReadWrite(MemoryClass mc)
offd->i = mem_offd.I.ReadWrite(mc, num_rows+1);
offd->j = mem_offd.J.ReadWrite(mc, offd_nnz);
offd->data = mem_offd.data.ReadWrite(mc, offd_nnz);
#if MFEM_HYPRE_VERSION >= 21400
HYPRE_MemoryLocation ml = (mc != GetHypreMemoryClass()
? HYPRE_MEMORY_HOST : HYPRE_MEMORY_DEVICE);
#if MFEM_HYPRE_VERSION >= 21800
decltype(diag->memory_location) ml =
(mc != GetHypreMemoryClass() ? HYPRE_MEMORY_HOST : HYPRE_MEMORY_DEVICE);
diag->memory_location = ml;
offd->memory_location = ml;
#endif
Expand All @@ -493,9 +493,9 @@ void HypreParMatrix::Write(MemoryClass mc, bool set_diag, bool set_offd)
offd->j = mem_offd.J.Write(mc, mem_offd.J.Capacity());
offd->data = mem_offd.data.Write(mc, mem_offd.data.Capacity());
}
#if MFEM_HYPRE_VERSION >= 21400
HYPRE_MemoryLocation ml = (mc != GetHypreMemoryClass()
? HYPRE_MEMORY_HOST : HYPRE_MEMORY_DEVICE);
#if MFEM_HYPRE_VERSION >= 21800
decltype(diag->memory_location) ml =
(mc != GetHypreMemoryClass() ? HYPRE_MEMORY_HOST : HYPRE_MEMORY_DEVICE);
if (set_diag) { diag->memory_location = ml; }
if (set_offd) { offd->memory_location = ml; }
#endif
Expand All @@ -515,7 +515,7 @@ void HypreParMatrix::WrapHypreParCSRMatrix(hypre_ParCSRMatrix *a, bool owner)
ParCSROwner = owner;
height = GetNumRows();
width = GetNumCols();
#if MFEM_HYPRE_VERSION >= 21400
#if MFEM_HYPRE_VERSION >= 21800
MemoryType diag_mt = (A->diag->memory_location == HYPRE_MEMORY_HOST
? MemoryType::HOST : GetHypreMemoryType());
MemoryType offd_mt = (A->offd->memory_location == HYPRE_MEMORY_HOST
Expand Down Expand Up @@ -643,6 +643,8 @@ signed char HypreParMatrix::HypreCsrToMem(hypre_CSRMatrix *h_mat,
// h_mat owns i; owns j,data if h_mat->owns_data
#if MFEM_HYPRE_VERSION < 21400
hypre_TFree(h_mat->i);
#elif MFEM_HYPRE_VERSION < 21800
hypre_TFree(h_mat->i, HYPRE_MEMORY_SHARED);
#else
hypre_TFree(h_mat->i, h_mat->memory_location);
#endif
Expand All @@ -651,6 +653,9 @@ signed char HypreParMatrix::HypreCsrToMem(hypre_CSRMatrix *h_mat,
#if MFEM_HYPRE_VERSION < 21400
hypre_TFree(h_mat->j);
hypre_TFree(h_mat->data);
#elif MFEM_HYPRE_VERSION < 21800
hypre_TFree(h_mat->j, HYPRE_MEMORY_SHARED);
hypre_TFree(h_mat->data, HYPRE_MEMORY_SHARED);
#else
hypre_TFree(h_mat->j, h_mat->memory_location);
hypre_TFree(h_mat->data, h_mat->memory_location);
Expand All @@ -661,7 +666,7 @@ signed char HypreParMatrix::HypreCsrToMem(hypre_CSRMatrix *h_mat,
h_mat->j = mem.J.ReadWrite(hypre_mc, nnz);
h_mat->data = mem.data.ReadWrite(hypre_mc, nnz);
h_mat->owns_data = 0;
#if MFEM_HYPRE_VERSION >= 21400
#if MFEM_HYPRE_VERSION >= 21800
h_mat->memory_location = HYPRE_MEMORY_DEVICE;
#endif
return 3;
Expand Down
4 changes: 2 additions & 2 deletions linalg/hypre_parcsr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void hypre_CSRMatrixElimCreate(hypre_CSRMatrix *A,
hypre_CSRMatrixJ(Ae) = mfem_hypre_TAlloc_host(HYPRE_Int, nnz);
hypre_CSRMatrixData(Ae) = mfem_hypre_TAlloc_host(HYPRE_Real, nnz);
hypre_CSRMatrixNumNonzeros(Ae) = nnz;
#if MFEM_HYPRE_VERSION >= 21400
#if MFEM_HYPRE_VERSION >= 21800
hypre_CSRMatrixMemoryLocation(Ae) = HYPRE_MEMORY_HOST;
#endif
}
Expand Down Expand Up @@ -753,7 +753,7 @@ void hypre_CSRMatrixSplit(hypre_CSRMatrix *A,
num_cols[j], 0);
hypre_CSRMatrixI(B) = mfem_hypre_CTAlloc_host(HYPRE_Int,
num_rows[i] + 1);
#if MFEM_HYPRE_VERSION >= 21400
#if MFEM_HYPRE_VERSION >= 21800
hypre_CSRMatrixMemoryLocation(B) = HYPRE_MEMORY_HOST;
#endif
blocks[i*nc + j] = B;
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# CONTRIBUTING.md for details.

# The current MFEM version as an integer, see also `CMakeLists.txt`.
MFEM_VERSION = 40201
MFEM_VERSION = 40300
MFEM_VERSION_STRING = $(shell printf "%06d" $(MFEM_VERSION) | \
sed -e 's/^0*\(.*.\)\(..\)\(..\)$$/\1.\2.\3/' -e 's/\.0/./g' -e 's/\.0$$//')

Expand Down
6 changes: 5 additions & 1 deletion mesh/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4110,7 +4110,11 @@ void Mesh::MakeRefined_(Mesh &orig_mesh, const Array<int> ref_factors,
}

MFEM_ASSERT(CheckElementOrientation(false) == 0, "");
MFEM_ASSERT(CheckBdrElementOrientation(false) == 0, "");

// The check below is disabled because is fails for parallel meshes with
// interior "boundary" element that, when such "boundary" element is between
// two elements on different processors.
// MFEM_ASSERT(CheckBdrElementOrientation(false) == 0, "");
}

Mesh Mesh::MakeSimplicial(const Mesh &orig_mesh)
Expand Down
24 changes: 14 additions & 10 deletions mesh/mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,6 @@ class Mesh
MFEM_DEPRECATED
Mesh(Mesh *orig_mesh, int ref_factor, int ref_type);

/// A version of the above constructor for non-uniform refinement.
/** The input array @a ref_factors contains one refinement factor per element
of the input mesh. */
Mesh(Mesh *orig_mesh, const Array<int> &ref_factors, int ref_type);

/** This is similar to the mesh constructor with the same arguments, but here
the current mesh is destroyed and another one created based on the data
stream again given in MFEM, Netgen, or VTK format. If generate_edges = 0
Expand Down Expand Up @@ -877,17 +872,26 @@ class Mesh
long GetGlobalNE() const { return ReduceInt(NumOfElements); }

/** @brief Return the mesh geometric factors corresponding to the given
integration rule. */
/** If the device MemoryType parameter @a d_mt is specified, then the
returned object will use that type unless it was previously allocated
with a different type. */
integration rule.
The IntegrationRule used with GetGeometricFactors needs to remain valid
until the internally stored GeometricFactors objects are destroyed (by
either calling Mesh::DeleteGeometricFactors or the Mesh destructor). If
the device MemoryType parameter @a d_mt is specified, then the returned
object will use that type unless it was previously allocated with a
different type. */
const GeometricFactors* GetGeometricFactors(
const IntegrationRule& ir,
const int flags,
MemoryType d_mt = MemoryType::DEFAULT);

/** @brief Return the mesh geometric factors for the faces corresponding
to the given integration rule. */
to the given integration rule.
The IntegrationRule used with GetFaceGeometricFactors needs to remain
valid until the internally stored FaceGeometricFactors objects are
destroyed (by either calling Mesh::DeleteGeometricFactors or the Mesh
destructor). */
const FaceGeometricFactors* GetFaceGeometricFactors(const IntegrationRule& ir,
const int flags,
FaceType type);
Expand Down
1 change: 0 additions & 1 deletion miniapps/meshing/polar-nc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,4 +557,3 @@ int main(int argc, char *argv[])

return EXIT_SUCCESS;
}

0 comments on commit 9d8043b

Please sign in to comment.