Skip to content

Commit

Permalink
Merge pull request #73 from LLNL/feature/timer-fixes
Browse files Browse the repository at this point in the history
Feature/timer fixes
  • Loading branch information
jmikeowen authored Jun 28, 2021
2 parents 03b98b6 + 675d1cc commit 1d1c410
Show file tree
Hide file tree
Showing 25 changed files with 166 additions and 121 deletions.
25 changes: 25 additions & 0 deletions scripts/lc-builds/toss3_gcc8.1.0-debug-mpi-cxx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

SCRIPT_PATH=${0%/*}
. "$SCRIPT_PATH/utils/parse-args.sh"

# Inherit build directory name from script name
BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})"

rm -rf ${BUILD_SUFFIX} 2>/dev/null
mkdir -p ${BUILD_SUFFIX}/install
mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build

module load cmake/3.14.5
module load gcc/8.1.0

cmake \
${SRC_DIR} \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.1.0/bin/g++ \
-C ${HOST_CONFIGS_DIR}/lc-builds/toss3/gcc8.1.0_tpl.cmake \
-DENABLE_OPENMP=On \
-DENABLE_MPI=On \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DENABLE_STATIC_CXXONLY=On \
$CMAKE_ARGS \
1 change: 0 additions & 1 deletion src/CRKSPH/SolidCRKSPHHydroBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "Neighbor/ConnectivityMap.hh"
#include "Utilities/timingUtilities.hh"
#include "Utilities/safeInv.hh"
#include "Utilities/ThreePointDamagedNodeCoupling.hh"
#include "SolidMaterial/SolidEquationOfState.hh"

#include "SolidCRKSPHHydroBase.hh"
Expand Down
7 changes: 7 additions & 0 deletions src/Damage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ set(Damage_inst
JohnsonCookFailureStrainPolicy
JohnsonCookDamagePolicy
DamagedPressurePolicy
PairMaxDamageNodeCoupling
ThreePointDamagedNodeCoupling
DamageGradientNodeCoupling
)


Expand Down Expand Up @@ -51,6 +54,10 @@ set(Damage_headers
oneMinusDamage.hh
weibullFlawDistributionBenzAsphaug.hh
weibullFlawDistributionOwen.hh
DamageGradientNodeCoupling.hh
PairMaxDamageNodeCoupling.hh
MaxDamageNodeCoupling.hh
ThreePointDamagedNodeCoupling.hh
)

spheral_install_python_files(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
// Created by JMO, Fri Jul 31 14:46:25 PDT 2015
//----------------------------------------------------------------------------//
#include "Utilities/DamageGradientNodeCoupling.hh"
#include "Damage/DamageGradientNodeCoupling.hh"
#include "Utilities/pointDistances.hh"
#include "Utilities/DBC.hh"
#include "Utilities/Timer.hh"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// Explicit instantiation.
//------------------------------------------------------------------------------
#include "Utilities/DamageGradientNodeCoupling.cc"
#include "Damage/DamageGradientNodeCoupling.cc"
namespace Spheral {
template class DamageGradientNodeCoupling< Dim< %(ndim)s > >;
Expand Down
10 changes: 5 additions & 5 deletions src/Damage/DamageModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#include "Boundary/Boundary.hh"
#include "Kernel/TableKernel.hh"
#include "Neighbor/ConnectivityMap.hh"
#include "Utilities/NodeCoupling.hh"
#include "Utilities/DamagedNodeCoupling.hh"
#include "Utilities/DamageGradientNodeCoupling.hh"
#include "Utilities/ThreePointDamagedNodeCoupling.hh"
#include "Utilities/GeometricUtilities.hh"
#include "Utilities/safeInv.hh"
#include "Utilities/Timer.hh"
#include "Utilities/NodeCoupling.hh"
#include "Damage/PairMaxDamageNodeCoupling.hh"
#include "Damage/DamageGradientNodeCoupling.hh"
#include "Damage/ThreePointDamagedNodeCoupling.hh"

#include "boost/shared_ptr.hpp"

Expand Down Expand Up @@ -150,7 +150,7 @@ initialize(const Scalar /*time*/,
break;

case DamageCouplingAlgorithm::PairMaxDamage:
mNodeCouplingPtr = std::make_shared<DamagedNodeCoupling<Dimension>>(state, pairs);
mNodeCouplingPtr = std::make_shared<PairMaxDamageNodeCoupling<Dimension>>(state, pairs);
break;

case DamageCouplingAlgorithm::DamageGradient:
Expand Down
1 change: 1 addition & 0 deletions src/Damage/DamageModel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum class DamageCouplingAlgorithm {
PairMaxDamage = 1,
DamageGradient = 2,
ThreePointDamage = 3,
TensorPairMaxDamage = 4,
};

template<typename Dimension>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//---------------------------------Spheral++----------------------------------//
// DamagedNodeCoupling
// PairMaxDamageNodeCoupling
//
// A functor class encapsulating how we couple solid nodes in the presence of
// multiple materials and damage.
//
// Created by JMO, Fri Jul 31 14:46:25 PDT 2015
//----------------------------------------------------------------------------//
#include "Utilities/DamagedNodeCoupling.hh"
#include "Damage/PairMaxDamageNodeCoupling.hh"
#include "Utilities/DBC.hh"
#include "Field/FieldList.hh"
#include "Hydro/HydroFieldNames.hh"
Expand Down Expand Up @@ -49,8 +49,8 @@ double scalarDamage(const FieldListType& damage,
// Constructor
//------------------------------------------------------------------------------
template<typename Dimension>
DamagedNodeCoupling<Dimension>::
DamagedNodeCoupling(const State<Dimension>& state,
PairMaxDamageNodeCoupling<Dimension>::
PairMaxDamageNodeCoupling(const State<Dimension>& state,
NodePairList& pairs):
NodeCoupling() {
const auto n = pairs.size();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//---------------------------------Spheral++----------------------------------//
// DamagedNodeCoupling
// PairMaxDamageNodeCoupling
//
// A functor class encapsulating how we couple solid nodes in the presence of
// multiple materials and damage.
Expand All @@ -9,29 +9,29 @@
// Created by JMO: Fri Jul 31 14:46:25 PDT 2015
// updated: Fri Feb 5 12:48:20 PST 2021 JMO
//----------------------------------------------------------------------------//
#ifndef __Spheral_DamagedNodeCoupling__
#define __Spheral_DamagedNodeCoupling__
#ifndef __Spheral_PairMaxDamageNodeCoupling__
#define __Spheral_PairMaxDamageNodeCoupling__

#include "Utilities/NodeCoupling.hh"
#include "DataBase/State.hh"

namespace Spheral {

template<typename Dimension>
class DamagedNodeCoupling: public NodeCoupling {
class PairMaxDamageNodeCoupling: public NodeCoupling {
public:
typedef typename Dimension::Scalar Scalar;
typedef typename Dimension::Vector Vector;
typedef typename Dimension::Tensor Tensor;
typedef typename Dimension::SymTensor SymTensor;

// Constructor.
DamagedNodeCoupling(const State<Dimension>& state,
PairMaxDamageNodeCoupling(const State<Dimension>& state,
NodePairList& pairs);

private:
// Forbidden methods.
DamagedNodeCoupling();
PairMaxDamageNodeCoupling();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//------------------------------------------------------------------------------
// Explicit instantiation.
//------------------------------------------------------------------------------
#include "Utilities/DamagedNodeCoupling.cc"
#include "Damage/PairMaxDamageNodeCoupling.cc"
namespace Spheral {
template class DamagedNodeCoupling< Dim< %(ndim)s > >;
template class PairMaxDamageNodeCoupling< Dim< %(ndim)s > >;
}
"""
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// Created by JMO, Fri Jan 1 15:18:38 PST 2021
//----------------------------------------------------------------------------//
#include "Utilities/ThreePointDamagedNodeCoupling.hh"
#include "Damage/ThreePointDamagedNodeCoupling.hh"
#include "Utilities/pointDistances.hh"
#include "Utilities/DBC.hh"
#include "Utilities/Timer.hh"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// Explicit instantiation.
//------------------------------------------------------------------------------
#include "Utilities/ThreePointDamagedNodeCoupling.cc"
#include "Damage/ThreePointDamagedNodeCoupling.cc"
namespace Spheral {
template class ThreePointDamagedNodeCoupling< Dim< %(ndim)s > >;
Expand Down
15 changes: 15 additions & 0 deletions src/Pybind11Wraps/Damage/DamageGradientNodeCoupling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#-------------------------------------------------------------------------------
# DamageGradientNodeCoupling
#-------------------------------------------------------------------------------
from PYB11Generator import *
import NodeCoupling

@PYB11template("Dimension")
class DamageGradientNodeCoupling(NodeCoupling.NodeCoupling):
"""A functor class encapsulating how we couple solid nodes in the presence of
multiple materials and damage.
This one attempts to mock up the shielding effect of ThreePointDamagedNodeCoupling
by using local damage gradient to estimate when nodes are separated by
regions of greater damage (or fractures)."""

13 changes: 12 additions & 1 deletion src/Pybind11Wraps/Damage/DamageMOD.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from TensorDamageModel import *
from ProbabilisticDamageModel import *
from JohnsonCookDamage import *
from PairMaxDamageNodeCoupling import *
from DamageGradientNodeCoupling import *
from ThreePointDamagedNodeCoupling import *

#-------------------------------------------------------------------------------
# Includes
Expand All @@ -26,6 +29,9 @@
'"Damage/weibullFlawDistributionBenzAsphaug.hh"',
'"Damage/weibullFlawDistributionOwen.hh"',
'"Damage/computeFragmentField.hh"',
'"Damage/PairMaxDamageNodeCoupling.hh"',
'"Damage/ThreePointDamagedNodeCoupling.hh"',
'"Damage/DamageGradientNodeCoupling.hh"',
'"FileIO/FileIO.hh"']

#-------------------------------------------------------------------------------
Expand All @@ -44,7 +50,8 @@
DamageCouplingAlgorithm = PYB11enum(("DirectDamage",
"PairMaxDamage",
"DamageGradient",
"ThreePointDamage"), export_values=True)
"ThreePointDamage",
"TensorPairMaxDamage"), export_values=True)

# Note the following enums are deprecated
EffectiveDamageAlgorithm = PYB11enum(("CopyDamage",
Expand Down Expand Up @@ -107,6 +114,10 @@ def computeFragmentField(nodeList = "const NodeList<%(Dimension)s>&",
ProbabilisticDamageModel%(ndim)id = PYB11TemplateClass(ProbabilisticDamageModel, template_parameters="%(Dimension)s")
JohnsonCookDamage%(ndim)id = PYB11TemplateClass(JohnsonCookDamage, template_parameters="%(Dimension)s")
PairMaxDamageNodeCoupling%(ndim)id = PYB11TemplateClass(PairMaxDamageNodeCoupling, template_parameters="%(Dimension)s")
ThreePointDamagedNodeCoupling%(ndim)id = PYB11TemplateClass(ThreePointDamagedNodeCoupling, template_parameters="%(Dimension)s")
DamageGradientNodeCoupling%(ndim)id = PYB11TemplateClass(DamageGradientNodeCoupling, template_parameters="%(Dimension)s")
weibullFlawDistributionBenzAsphaug%(ndim)id = PYB11TemplateFunction(weibullFlawDistributionBenzAsphaug, template_parameters="%(Dimension)s")
weibullFlawDistributionOwen%(ndim)id = PYB11TemplateFunction(weibullFlawDistributionOwen, template_parameters="%(Dimension)s")
computeFragmentField%(ndim)id = PYB11TemplateFunction(computeFragmentField, template_parameters="%(Dimension)s")
Expand Down
25 changes: 25 additions & 0 deletions src/Pybind11Wraps/Damage/PairMaxDamageNodeCoupling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#-------------------------------------------------------------------------------
# PairMaxDamageNodeCoupling
#-------------------------------------------------------------------------------
from PYB11Generator import *
import NodeCoupling

@PYB11template("Dimension")
class PairMaxDamageNodeCoupling(NodeCoupling.NodeCoupling):
"""A functor class encapsulating how we couple solid nodes in the presence of
multiple materials and damage.
This form simply directly damages each pair based on their mutual damage."""

PYB11typedefs = """
typedef typename %(Dimension)s::Scalar Scalar;
typedef typename %(Dimension)s::Vector Vector;
typedef typename %(Dimension)s::Tensor Tensor;
typedef typename %(Dimension)s::SymTensor SymTensor;
"""

def pyinit(self,
state = "const State<%(Dimension)s>&",
pairs = "NodePairList&"):
"Constructor"

26 changes: 26 additions & 0 deletions src/Pybind11Wraps/Damage/ThreePointDamagedNodeCoupling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#-------------------------------------------------------------------------------
# ThreePointDamagedNodeCoupling
#-------------------------------------------------------------------------------
from PYB11Generator import *
import NodeCoupling

@PYB11template("Dimension")
class ThreePointDamagedNodeCoupling(NodeCoupling.NodeCoupling):
"""A functor class encapsulating how we couple solid nodes in the presence of
multiple materials and damage.
This for uses the "three point" formalism, which allows damaged points to
cut communication between pairs that talk across them."""

PYB11typedefs = """
typedef typename %(Dimension)s::Scalar Scalar;
typedef typename %(Dimension)s::Vector Vector;
typedef typename %(Dimension)s::Tensor Tensor;
typedef typename %(Dimension)s::SymTensor SymTensor;
"""

def pyinit(self,
state = "const State<%(Dimension)s>&",
W = "const TableKernel<%(Dimension)s>&",
pairs = "NodePairList&"):
"Constructor"
57 changes: 0 additions & 57 deletions src/Pybind11Wraps/Utilities/NodeCoupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,3 @@ def __call__(self,
"Functional method to override for coupling (nodeListi, i) <-> (nodeListj, j)"
return "double"

#-------------------------------------------------------------------------------
# DamagedNodeCoupling
#-------------------------------------------------------------------------------
@PYB11template("Dimension")
class DamagedNodeCoupling(NodeCoupling):
"""A functor class encapsulating how we couple solid nodes in the presence of
multiple materials and damage.
This form simply directly damages each pair based on their mutual damage."""

PYB11typedefs = """
typedef typename %(Dimension)s::Scalar Scalar;
typedef typename %(Dimension)s::Vector Vector;
typedef typename %(Dimension)s::Tensor Tensor;
typedef typename %(Dimension)s::SymTensor SymTensor;
"""

def pyinit(self,
state = "const State<%(Dimension)s>&",
pairs = "NodePairList&"):
"Constructor"

#-------------------------------------------------------------------------------
# DamageGradientNodeCoupling
#-------------------------------------------------------------------------------
@PYB11template("Dimension")
class DamageGradientNodeCoupling(NodeCoupling):
"""A functor class encapsulating how we couple solid nodes in the presence of
multiple materials and damage.
This one attempts to mock up the shielding effect of ThreePointDamagedNodeCoupling
by using local damage gradient to estimate when nodes are separated by
regions of greater damage (or fractures)."""

#-------------------------------------------------------------------------------
# ThreePointDamagedNodeCoupling
#-------------------------------------------------------------------------------
@PYB11template("Dimension")
class ThreePointDamagedNodeCoupling(NodeCoupling):
"""A functor class encapsulating how we couple solid nodes in the presence of
multiple materials and damage.
This for uses the "three point" formalism, which allows damaged points to
cut communication between pairs that talk across them."""

PYB11typedefs = """
typedef typename %(Dimension)s::Scalar Scalar;
typedef typename %(Dimension)s::Vector Vector;
typedef typename %(Dimension)s::Tensor Tensor;
typedef typename %(Dimension)s::SymTensor SymTensor;
"""

def pyinit(self,
state = "const State<%(Dimension)s>&",
W = "const TableKernel<%(Dimension)s>&",
pairs = "NodePairList&"):
"Constructor"
7 changes: 0 additions & 7 deletions src/Pybind11Wraps/Utilities/UtilitiesMOD.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
'"Utilities/Timer.hh"',
'"Utilities/DomainNode.hh"',
'"Utilities/NodeCoupling.hh"',
'"Utilities/DamagedNodeCoupling.hh"',
'"Utilities/ThreePointDamagedNodeCoupling.hh"',
'"Utilities/DamageGradientNodeCoupling.hh"',
'"Utilities/uniform_random.hh"',
'<algorithm>']

Expand Down Expand Up @@ -258,10 +255,6 @@ def computeShepardsInterpolation(fieldList = "const FieldList<%(Dimension)s, %(D
# Instantiate stuff for the dimensions Spheral is building
for ndim in dims:
exec('''
DamagedNodeCoupling%(ndim)id = PYB11TemplateClass(DamagedNodeCoupling, template_parameters="%(Dimension)s")
ThreePointDamagedNodeCoupling%(ndim)id = PYB11TemplateClass(ThreePointDamagedNodeCoupling, template_parameters="%(Dimension)s")
DamageGradientNodeCoupling%(ndim)id = PYB11TemplateClass(DamageGradientNodeCoupling, template_parameters="%(Dimension)s")
# Functors
VectorScalarFunctor%(ndim)id = PYB11TemplateClass(SpheralFunctor, template_parameters=("%(Vector)s", "double"))
VectorVectorFunctor%(ndim)id = PYB11TemplateClass(SpheralFunctor, template_parameters=("%(Vector)s", "%(Vector)s"))
Expand Down
Loading

0 comments on commit 1d1c410

Please sign in to comment.