From ece63c90ded8d1decda84179360b3a861f1b8f0d Mon Sep 17 00:00:00 2001 From: wrtobin Date: Thu, 26 Aug 2021 08:53:05 -0700 Subject: [PATCH 01/10] should be full impl for kernels/sparsity kernels for both standard and jit compilation, testing and configuration still needed --- .../finiteElement/CMakeLists.txt | 14 +- .../kernelInterface/KernelBase.hpp | 232 +++++++++++++----- .../kernelInterface/SparsityKernelBase.hpp | 218 +++++++++++++--- .../MultiphasePoromechanicsKernel.hpp | 24 +- .../MultiphasePoromechanicsSolver.cpp | 21 +- .../SinglePhasePoromechanicsKernel.hpp | 16 +- .../SinglePhasePoromechanicsSolver.cpp | 17 +- .../physicsSolvers/simplePDE/LaplaceFEM.cpp | 23 +- .../simplePDE/LaplaceFEMKernels.hpp | 10 +- .../simplePDE/PhaseFieldDamageFEM.cpp | 15 +- .../simplePDE/PhaseFieldDamageFEMKernels.hpp | 14 +- .../SolidMechanicsEFEMKernels.hpp | 16 +- .../SolidMechanicsEmbeddedFractures.cpp | 17 +- ...anicsFiniteStrainExplicitNewmarkKernel.hpp | 6 +- .../SolidMechanicsLagrangianFEM.cpp | 65 ++--- .../SolidMechanicsLagrangianFEM.hpp | 9 +- ...hanicsSmallStrainExplicitNewmarkKernel.hpp | 6 +- ...hanicsSmallStrainImplicitNewmarkKernel.hpp | 22 +- ...dMechanicsSmallStrainQuasiStaticKernel.hpp | 12 +- 19 files changed, 521 insertions(+), 236 deletions(-) diff --git a/src/coreComponents/finiteElement/CMakeLists.txt b/src/coreComponents/finiteElement/CMakeLists.txt index 9293f1a56d9..18a021d595e 100644 --- a/src/coreComponents/finiteElement/CMakeLists.txt +++ b/src/coreComponents/finiteElement/CMakeLists.txt @@ -19,6 +19,7 @@ set( finiteElement_headers elementFormulations/H1_Wedge_Lagrange1_Gauss6.hpp elementFormulations/LagrangeBasis1.hpp elementFormulations/LagrangeBasis2.hpp + ${CMAKE_BINARY_DIR}/include/kernelJITCompileCommands.hpp ) # # Specify all sources @@ -26,6 +27,7 @@ set( finiteElement_headers set( finiteElement_sources FiniteElementDiscretization.cpp FiniteElementDiscretizationManager.cpp + kernelInterface/kernelJIT.cpp ) set( dependencyList dataRepository ) @@ -37,12 +39,22 @@ endif() blt_add_library( NAME finiteElement SOURCES ${finiteElement_sources} HEADERS ${finiteElement_headers} - DEPENDS_ON ${dependencyList} + DEFINES JITTI_OUTPUT_DIR="${CMAKE_BINARY_DIR}/lib/jitti" + DEPENDS_ON ${dependencyList} jitti OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) target_include_directories( finiteElement PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents) +add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/include/kernelJITCompileCommands.hpp + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND python ${CMAKE_CURRENT_LIST_DIR}/../LvArray/src/jitti/generateCompileCommandsHeader.py + ${CMAKE_BINARY_DIR}/compile_commands.json + --cpp ${CMAKE_CURRENT_LIST_DIR}/kernelInterface/kernelJIT.cpp + --hpp ${CMAKE_BINARY_DIR}/include/kernelJITCompileCommands.hpp + --include ${CMAKE_BINARY_DIR}/include + --linker ${CMAKE_CXX_COMPILER} ) + geosx_add_code_checks( PREFIX finiteElement ) add_subdirectory( unitTests ) diff --git a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp index d2ada78c940..3301081a993 100644 --- a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp @@ -24,8 +24,10 @@ #include "common/TimingMacros.hpp" #include "constitutive/ConstitutivePassThru.hpp" #include "finiteElement/FiniteElementDispatch.hpp" +#include "mesh/MeshLevel.hpp" #include "mesh/ElementRegionManager.hpp" #include "common/GEOS_RAJA_Interface.hpp" +#include "LvArray/src/jitti/Cache.hpp" namespace geosx { @@ -258,52 +260,24 @@ class KernelBase FE_TYPE const & m_finiteElementSpace; }; -/** - * @class KernelFactory - * @brief Used to forward arguments to a class that implements the KernelBase interface. - * @tparam KERNEL_TYPE The template class to construct, should implement the KernelBase interface. - * @tparam ARGS The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. - */ -template< template< typename SUBREGION_TYPE, - typename CONSTITUTIVE_TYPE, - typename FE_TYPE > class KERNEL_TYPE, - typename ... ARGS > -class KernelFactory -{ -public: - - /** - * @brief Initialize the factory. - * @param args The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. - */ - KernelFactory( ARGS ... args ): - m_args( args ... ) - {} - - /** - * @brief Create a new kernel with the given standard arguments. - * @tparam SUBREGION_TYPE The type of @p elementSubRegion. - * @tparam CONSTITUTIVE_TYPE The type of @p inputConstitutiveType. - * @tparam FE_TYPE The type of @p finiteElementSpace. - * @param nodeManager The node manager. - * @param edgeManager The edge manager. - * @param faceManager The face manager. - * @param targetRegionIndex The target region index. - * @param elementSubRegion The subregion to execute on. - * @param finiteElementSpace The finite element space. - * @param inputConstitutiveType The constitutive relation. - * @return A new kernel constructed with the given arguments and @c ARGS. - */ - template< typename SUBREGION_TYPE, typename CONSTITUTIVE_TYPE, typename FE_TYPE > - KERNEL_TYPE< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE > createKernel( + template< typename POLICY, + typename SUBREGION_TYPE, + typename CONSTITUTIVE_TYPE, + typename FE_TYPE, + template< typename, typename, typename > class KERNEL_TEMPLATE, + typename KERNEL_CONSTRUCTOR_PARAMS > + real64 buildKernelAndInvoke( + localIndex const numElems, NodeManager & nodeManager, EdgeManager const & edgeManager, FaceManager const & faceManager, localIndex const targetRegionIndex, SUBREGION_TYPE const & elementSubRegion, FE_TYPE const & finiteElementSpace, - CONSTITUTIVE_TYPE & inputConstitutiveType ) + CONSTITUTIVE_TYPE & inputConstitutiveType, + KERNEL_CONSTRUCTOR_PARAMS const & kernelParamsTuple ) { + using KERNEL_TYPE = KERNEL_TEMPLATE< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE >; camp::tuple< NodeManager &, EdgeManager const &, FaceManager const &, @@ -317,16 +291,149 @@ class KernelFactory elementSubRegion, finiteElementSpace, inputConstitutiveType }; - - auto allArgs = camp::tuple_cat_pair( standardArgs, m_args ); - return camp::make_from_tuple< KERNEL_TYPE< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE > >( allArgs ); + auto allArgs = camp::tuple_cat_pair( standardArgs, kernelParamsTuple ); + KERNEL_TYPE kernel = camp::make_from_tuple< KERNEL_TYPE >( allArgs ); + return KERNEL_TYPE::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernel ); } -private: - /// The arguments to append to the standard kernel constructor arguments. - camp::tuple< ARGS ... > m_args; -}; +// cpp20 should allow some simplification here, since prior to that string literals can't be used as value template params +// and camp doesn't appear to have a mechanism to mitigate this +#if JITTI + #define JITTI_TPARAM( X ) std::nullptr_t + #define KernelDispatch KernelJITDispatch +#else + #define JITTI_TPARAM( X ) X + #define KernelDispatch KernelTemplateDispatch +#endif + + jitti::CompilationInfo getKernelCompilationInfo( ); + + /** + * @class KernelTemplateDispatch + * @brief Used to forward arguments to a class that implements the KernelBase interface. + * @tparam KERNEL_TYPE The template class to construct, should implement the KernelBase interface. + * @tparam ARGS The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. + */ + // template< typename KernelClass > // subclass on typename vs const char * which will do the JIT + template< template < typename SUBREGION_TYPE, typename CONSTITUTIVE_TYPE, typename FE_TYPE > class KERNEL_TYPE, typename ... ARGS > + class KernelTemplateDispatch + { + public: + + /** + * @brief Initialize the factory. + * @param args The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. + */ + KernelTemplateDispatch( string const & scopedKernelName, ARGS ... args ): + m_kernelName( scopedKernelName ), + m_args( args ... ) + {} + + template < typename POLICY, + typename SUBREGION_TYPE, + typename FE_TYPE, + typename CONSTITUTIVE_TYPE > + real64 invoke( localIndex const numElems, + NodeManager & nodeManager, + EdgeManager const & edgeManager, + FaceManager const & faceManager, + localIndex const targetRegionIndex, + SUBREGION_TYPE const & elementSubRegion, + FE_TYPE const & finiteElementSpace, + CONSTITUTIVE_TYPE & inputConstitutiveType ) + { + return buildKernelAndInvoke< POLICY, + SUBREGION_TYPE, + CONSTITUTIVE_TYPE, + FE_TYPE, + KERNEL_TYPE, + decltype( m_args )> ( numElems, + nodeManager, + edgeManager, + faceManager, + targetRegionIndex, + elementSubRegion, + finiteElementSpace, + inputConstitutiveType, + m_args ); + + } + + private: + + string const m_kernelName; + /// The arguments to append to the standard kernel constructor arguments. + camp::tuple< ARGS ... > m_args; + }; + + // compiles the kernel using jitti caching + template < std::nullptr_t, typename ... ARGS > + class KernelJITDispatch + { + + /** + * @brief Initialize the factory. + * @param args The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. + */ + KernelJITDispatch( string const & scopedKernelName, ARGS ... args ): + m_kernelName( scopedKernelName ), + m_args( args ... ) + {} + + template < typename POLICY, + typename SUBREGION_TYPE, + typename FE_TYPE, + typename CONSTITUTIVE_TYPE > + real64 invoke( localIndex const numElems, + NodeManager & nodeManager, + EdgeManager const & edgeManager, + FaceManager const & faceManager, + localIndex const targetRegionIndex, + SUBREGION_TYPE const & elementSubRegion, + FE_TYPE const & finiteElementSpace, + CONSTITUTIVE_TYPE & inputConstitutiveType ) + { + jitti::CompilationInfo info = getKernelCompilationInfo( ); + + info.templateParams = LvArray::system::demangleType< POLICY >() + ", " + + LvArray::system::demangleType< SUBREGION_TYPE >() + ", " + + LvArray::system::demangleType< CONSTITUTIVE_TYPE >() + ", " + + LvArray::system::demangleType< FE_TYPE >() + ", " + + m_kernelName + + LvArray::system::demangleType< decltype( m_args ) >(); + + // Unfortunately can't just decltype(&buildKernelAndInvoke) since we can't fully specify the function template + using JIT_KERNEL_DISPATCH = real64 (*)( localIndex const, + NodeManager &, + EdgeManager const &, + FaceManager const &, + localIndex const, + SUBREGION_TYPE const &, + FE_TYPE const &, + CONSTITUTIVE_TYPE const &, + decltype( m_args ) const & ); + string outputDir(JITTI_OUTPUT_DIR); + outputDir += "/"; + static jitti::Cache< JIT_KERNEL_DISPATCH > buildCache( time(NULL), outputDir ); + auto & jitKernelDispatch = buildCache.getOrLoadOrCompile( info ); + + return jitKernelDispatch( numElems, + nodeManager, + edgeManager, + faceManager, + targetRegionIndex, + elementSubRegion, + finiteElementSpace, + inputConstitutiveType, + m_args ); + } + + private: + string const m_kernelName; + /// The arguments to append to the standard kernel constructor arguments. + camp::tuple< ARGS ... > m_args; + }; //***************************************************************************** //***************************************************************************** @@ -357,13 +464,13 @@ class KernelFactory template< typename POLICY, typename CONSTITUTIVE_BASE, typename SUBREGION_TYPE, - typename KERNEL_FACTORY > + typename KERNEL_DISPATCH > static real64 regionBasedKernelApplication( MeshLevel & mesh, arrayView1d< string const > const & targetRegions, string const & finiteElementName, arrayView1d< string const > const & constitutiveNames, - KERNEL_FACTORY & kernelFactory ) + KERNEL_DISPATCH & kernelDispatch ) { GEOSX_MARK_FUNCTION; // save the maximum residual contribution for scaling residuals for convergence criteria. @@ -381,7 +488,7 @@ real64 regionBasedKernelApplication( MeshLevel & mesh, &nodeManager, &edgeManager, &faceManager, - &kernelFactory, + &kernelDispatch, &finiteElementName] ( localIndex const targetRegionIndex, auto & elementSubRegion ) { @@ -407,7 +514,7 @@ real64 regionBasedKernelApplication( MeshLevel & mesh, &edgeManager, &faceManager, targetRegionIndex, - &kernelFactory, + &kernelDispatch, &elementSubRegion, &finiteElementName, numElems] @@ -422,25 +529,20 @@ real64 regionBasedKernelApplication( MeshLevel & mesh, &edgeManager, &faceManager, targetRegionIndex, - &kernelFactory, + &kernelDispatch, &elementSubRegion, numElems, &castedConstitutiveRelation] ( auto const finiteElement ) { - auto kernel = kernelFactory.createKernel( nodeManager, - edgeManager, - faceManager, - targetRegionIndex, - elementSubRegion, - finiteElement, - castedConstitutiveRelation ); - - using KERNEL_TYPE = decltype( kernel ); - - // Call the kernelLaunch function, and store the maximum contribution to the residual. - maxResidualContribution = - std::max( maxResidualContribution, - KERNEL_TYPE::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernel ) ); + maxResidualContribution = std::max( maxResidualContribution, + kernelDispatch.template invoke< POLICY >( numElems, + nodeManager, + edgeManager, + faceManager, + targetRegionIndex, + elementSubRegion, + finiteElement, + castedConstitutiveRelation ) ); } ); } ); diff --git a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp index ec137384c37..08caf4a97f8 100644 --- a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp @@ -171,6 +171,50 @@ class SparsityKernelBase : public ImplicitKernelBase< SUBREGION_TYPE, //***************************************************************************** //***************************************************************************** //***************************************************************************** + +template < typename POLICY, + typename SUBREGION_TYPE, + typename CONSTITUTIVE_TYPE, + typename FE_TYPE, + template < typename, typename, typename > class KERNEL_TEMPLATE > +real64 buildSparsityAndInvoke( localIndex const numElems, + NodeManager const & nodeManager, + EdgeManager const & edgeManager, + FaceManager const & faceManager, + localIndex const targetRegionIndex, + SUBREGION_TYPE const & elementSubRegion, + FE_TYPE const & finiteElementSpace, + CONSTITUTIVE_TYPE & inputConstitutiveType, + arrayView1d< globalIndex const > const & inputDofNumber, + globalIndex const rankOffset, + SparsityPattern< globalIndex > & inputSparsityPattern ) +{ + // this requires the underlying kernel be fully specified and instantiated.. which means we'll compile it + // to avoid this we'll have to JIT a function that handles + using Kernel = KERNEL_TEMPLATE< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE >; + using SPARSITY_KERNEL_TYPE = SparsityKernelBase< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE, Kernel::numDofPerTestSupportPoint, Kernel::numDofPerTrialSupportPoint >; + SPARSITY_KERNEL_TYPE kernel ( nodeManager, + edgeManager, + faceManager, + targetRegionIndex, + elementSubRegion, + finiteElementSpace, + inputConstitutiveType, + inputDofNumber, + rankOffset, + inputSparsityPattern ); + return SPARSITY_KERNEL_TYPE::template kernelLaunch< POLICY, SPARSITY_KERNEL_TYPE >( numElems, kernel ); +} + +#if JITTI + #define SparsityKernelDispatch SparsityKernelJITDispatch +#else + #define SparsityKernelDispatch SparsityKernelTemplateDispatch +#endif + +jitti::CompilationInfo getSparsityCompilationInfo( ); + + /** * @brief Helper struct to define a specialization of * #::geosx::finiteElement::SparsityKernelBase that may be used to generate the sparsity pattern. @@ -180,7 +224,7 @@ class SparsityKernelBase : public ImplicitKernelBase< SUBREGION_TYPE, template< template< typename, typename, typename > class KERNEL_TEMPLATE > -class SparsityKernelFactory +class SparsityKernelTemplateDispatch { public: @@ -190,9 +234,11 @@ class SparsityKernelFactory * @param rankOffset The global rank offset. * @param inputSparsityPattern The local sparsity pattern. */ - SparsityKernelFactory( arrayView1d< globalIndex const > const & inputDofNumber, - globalIndex const rankOffset, - SparsityPattern< globalIndex > & inputSparsityPattern ): + SparsityKernelTemplateDispatch( string const & scopedKernelName, + arrayView1d< globalIndex const > const & inputDofNumber, + globalIndex const rankOffset, + SparsityPattern< globalIndex > & inputSparsityPattern ): + m_kernelName( scopedKernelName ), m_inputDofNumber( inputDofNumber ), m_rankOffset( rankOffset ), m_inputSparsityPattern( inputSparsityPattern ) @@ -212,34 +258,141 @@ class SparsityKernelFactory * @param inputConstitutiveType The constitutive relation. * @return A new instance of @c SparsityKernelBase specialized for @c KERNEL_TEMPLATE. */ - template< typename SUBREGION_TYPE, typename CONSTITUTIVE_TYPE, typename FE_TYPE > - auto createKernel( NodeManager const & nodeManager, - EdgeManager const & edgeManager, - FaceManager const & faceManager, - localIndex const targetRegionIndex, - SUBREGION_TYPE const & elementSubRegion, - FE_TYPE const & finiteElementSpace, - CONSTITUTIVE_TYPE & inputConstitutiveType ) + template< typename POLICY, + typename SUBREGION_TYPE, + typename CONSTITUTIVE_TYPE, + typename FE_TYPE > + real64 invoke( localIndex const numElems, + NodeManager const & nodeManager, + EdgeManager const & edgeManager, + FaceManager const & faceManager, + localIndex const targetRegionIndex, + SUBREGION_TYPE const & elementSubRegion, + FE_TYPE const & finiteElementSpace, + CONSTITUTIVE_TYPE & inputConstitutiveType ) { - using Kernel = KERNEL_TEMPLATE< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE >; + return buildSparsityAndInvoke< POLICY, + SUBREGION_TYPE, + CONSTITUTIVE_TYPE, + FE_TYPE, + KERNEL_TEMPLATE >( numElems, + nodeManager, + edgeManager, + faceManager, + targetRegionIndex, + elementSubRegion, + finiteElementSpace, + inputConstitutiveType, + m_inputDofNumber, + m_rankOffset, + m_inputSparsityPattern ); + } + +private: + string const m_kernelName; + /// The input degree of freedom numbers. + arrayView1d< globalIndex const > const & m_inputDofNumber; + /// The global rank offset. + globalIndex const m_rankOffset; + /// The local sparsity pattern. + SparsityPattern< globalIndex > & m_inputSparsityPattern; +}; + + +/** + * @brief Helper struct to define a specialization of + * #::geosx::finiteElement::SparsityKernelBase that may be used to generate the sparsity pattern. + * @tparam KERNEL_TEMPLATE Templated class that defines the physics kernel. + * Most likely derives from SparsityKernelBase. + */ +template< template< typename, + typename, + typename > class KERNEL_TEMPLATE > +class SparsityKernelJITDispatch +{ +public: + + /** + * @brief Constructor. + * @param inputDofNumber An array containing the input degree of freedom numbers. + * @param rankOffset The global rank offset. + * @param inputSparsityPattern The local sparsity pattern. + */ + SparsityKernelJITDispatch( string const & scopedKernelName, + arrayView1d< globalIndex const > const & inputDofNumber, + globalIndex const rankOffset, + SparsityPattern< globalIndex > & inputSparsityPattern ): + m_kernelName( scopedKernelName ), + m_inputDofNumber( inputDofNumber ), + m_rankOffset( rankOffset ), + m_inputSparsityPattern( inputSparsityPattern ) + {} + + /** + * @brief Return a new instance of @c SparsityKernelBase specialized for @c KERNEL_TEMPLATE. + * @tparam SUBREGION_TYPE The type of of @p elementSubRegion. + * @tparam CONSTITUTIVE_TYPE The type of @p inputConstitutiveType. + * @tparam FE_TYPE The type of @p finiteElementSpace. + * @param nodeManager The node manager. + * @param edgeManager The edge manager. + * @param faceManager The face manager. + * @param targetRegionIndex The target region index. + * @param elementSubRegion The sub region on which to generate the sparsity. + * @param finiteElementSpace The finite element space. + * @param inputConstitutiveType The constitutive relation. + * @return A new instance of @c SparsityKernelBase specialized for @c KERNEL_TEMPLATE. + */ + template< typename POLICY, + typename SUBREGION_TYPE, + typename CONSTITUTIVE_TYPE, + typename FE_TYPE > + real64 invoke( localIndex const numElems, + NodeManager const & nodeManager, + EdgeManager const & edgeManager, + FaceManager const & faceManager, + localIndex const targetRegionIndex, + SUBREGION_TYPE const & elementSubRegion, + FE_TYPE const & finiteElementSpace, + CONSTITUTIVE_TYPE & inputConstitutiveType ) + { + jitti::CompilationInfo info = getSparsityCompilationInfo(); + info.templateParams = LvArray::system::demangleType< POLICY >() + ", " + + LvArray::system::demangleType< SUBREGION_TYPE >() + ", " + + LvArray::system::demangleType< CONSTITUTIVE_TYPE >() + ", " + + LvArray::system::demangleType< FE_TYPE >() + ", " + + m_kernelName; + // Unfortunately can't just decltype(&buildSparsityAndInvoke) since we can't fully specify the function template + using JIT_SPARSITY_DISPATCH = real64(*)( localIndex const, + NodeManager const &, + EdgeManager const &, + FaceManager const &, + localIndex const, + SUBREGION_TYPE const &, + FE_TYPE const &, + CONSTITUTIVE_TYPE &, + arrayView1d< globalIndex const > const &, + globalIndex const, + SparsityPattern< globalIndex > & ); + string outputDir( JITTI_OUTPUT_DIR ); + outputDir += "/"; + static jitti::Cache< JIT_SPARSITY_DISPATCH > buildCache( time(NULL), outputDir ); + auto & jitSparsityDispatch = buildCache.getOrLoadOrCompile( info ); + return jitSparsityDispatch( numElems, + nodeManager, + edgeManager, + faceManager, + targetRegionIndex, + elementSubRegion, + finiteElementSpace, + inputConstitutiveType, + m_inputDofNumber, + m_rankOffset, + m_inputSparsityPattern ); - return SparsityKernelBase< SUBREGION_TYPE, - CONSTITUTIVE_TYPE, - FE_TYPE, - Kernel::numDofPerTestSupportPoint, - Kernel::numDofPerTrialSupportPoint >( nodeManager, - edgeManager, - faceManager, - targetRegionIndex, - elementSubRegion, - finiteElementSpace, - inputConstitutiveType, - m_inputDofNumber, - m_rankOffset, - m_inputSparsityPattern ); } private: + string const m_kernelName; /// The input degree of freedom numbers. arrayView1d< globalIndex const > const & m_inputDofNumber; /// The global rank offset. @@ -273,11 +426,10 @@ class SparsityKernelFactory * pattern specified in the physics kernels. */ template< typename REGION_TYPE, - template< typename SUBREGION_TYPE, - typename CONSTITUTIVE_TYPE, - typename FE_TYPE > class KERNEL_TEMPLATE > + typename KERNEL_WRAPPER > static -real64 fillSparsity( MeshLevel & mesh, +real64 fillSparsity( string const & kernelName, + MeshLevel & mesh, arrayView1d< string const > const & targetRegions, string const & discretizationName, arrayView1d< globalIndex const > const & inputDofNumber, @@ -286,7 +438,7 @@ real64 fillSparsity( MeshLevel & mesh, { GEOSX_MARK_FUNCTION; - SparsityKernelFactory< KERNEL_TEMPLATE > KernelFactory( inputDofNumber, rankOffset, inputSparsityPattern ); + KERNEL_WRAPPER kernelDispatch( kernelName, inputDofNumber, rankOffset, inputSparsityPattern ); regionBasedKernelApplication< serialPolicy, constitutive::NullModel, @@ -294,7 +446,7 @@ real64 fillSparsity( MeshLevel & mesh, targetRegions, discretizationName, arrayView1d< string const >(), - KernelFactory ); + kernelDispatch ); return 0; } diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp index afa5f599eb4..1173a90e801 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp @@ -577,18 +577,18 @@ class Multiphase : localIndex const m_numPhases; }; -using MultiphaseKernelFactory = finiteElement::KernelFactory< Multiphase, - arrayView1d< globalIndex const > const &, - string const &, - globalIndex const, - real64 const (&)[3], - localIndex const, - localIndex const, - arrayView1d< string const > const, - CRSMatrixView< real64, globalIndex const > const &, - arrayView1d< real64 > const & >; - -} // namespace PoroelasticKernels +using MultiphaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( Multiphase ), + arrayView1d< globalIndex const > const &, + string const &, + globalIndex const, + real64 const (&)[3], + localIndex const, + localIndex const, + arrayView1d< string const > const, + CRSMatrixView< real64, globalIndex const > const &, + arrayView1d< real64 > const & >; + +} // namespace PoromechanicsKernels } // namespace geosx diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp index 0619c251e76..149694ae546 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp @@ -192,15 +192,16 @@ void MultiphasePoromechanicsSolver::assembleSystem( real64 const time_n, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - PoromechanicsKernels::MultiphaseKernelFactory kernelFactory( displacementDofNumber, - flowDofKey, - dofManager.rankOffset(), - gravityVectorData, - numComponents, - numPhases, - m_flowSolver->fluidModelNames(), - localMatrix, - localRhs ); + PoromechanicsKernels::MultiphaseKernelDispatch kernelDispatch( "geosx::Multiphase", + displacementDofNumber, + flowDofKey, + dofManager.rankOffset(), + gravityVectorData, + numComponents, + numPhases, + m_flowSolver->fluidModelNames(), + localMatrix, + localRhs ); // Cell-based contributions m_solidSolver->getMaxForce() = @@ -211,7 +212,7 @@ void MultiphasePoromechanicsSolver::assembleSystem( real64 const time_n, targetRegionNames(), this->getDiscretizationName(), porousMaterialNames(), - kernelFactory ); + kernelDispatch ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp index 4a1cffc23a7..bd8eaae1535 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp @@ -404,14 +404,14 @@ class SinglePhase : }; -using SinglePhaseKernelFactory = finiteElement::KernelFactory< SinglePhase, - arrayView1d< globalIndex const > const &, - string const &, - globalIndex const, - CRSMatrixView< real64, globalIndex const > const &, - arrayView1d< real64 > const &, - real64 const (&)[3], - arrayView1d< string const > const >; +using SinglePhaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( SinglePhase ), + arrayView1d< globalIndex const > const &, + string const &, + globalIndex const, + CRSMatrixView< real64, globalIndex const > const &, + arrayView1d< real64 > const &, + real64 const (&)[3], + arrayView1d< string const > const >; } // namespace PoroelasticKernels diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp index dadb3d54f3c..1b7fb290b7d 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp @@ -197,13 +197,14 @@ void SinglePhasePoromechanicsSolver::assembleSystem( real64 const time_n, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - PoromechanicsKernels::SinglePhaseKernelFactory kernelFactory( dispDofNumber, - pDofKey, - dofManager.rankOffset(), - localMatrix, - localRhs, - gravityVectorData, - m_flowSolver->fluidModelNames() ); + PoromechanicsKernels::SinglePhaseKernelDispatch kernelDispatch( "geosx::PoromechanicsKernels::SinglePhase", + dispDofNumber, + pDofKey, + dofManager.rankOffset(), + localMatrix, + localRhs, + gravityVectorData, + m_flowSolver->fluidModelNames() ); // Cell-based contributions m_solidSolver->getMaxForce() = @@ -214,7 +215,7 @@ void SinglePhasePoromechanicsSolver::assembleSystem( real64 const time_n, targetRegionNames(), this->getDiscretizationName(), porousMaterialNames(), - kernelFactory ); + kernelDispatch ); // Face-based contributions m_flowSolver->assembleFluxTerms( time_n, dt, diff --git a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp index 02f62c3c157..67b362c91e5 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp +++ b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp @@ -108,13 +108,14 @@ void LaplaceFEM::setupSystem( DomainPartition & domain, dofManager.numGlobalDofs(), 8*8*3 ); - finiteElement::fillSparsity< CellElementSubRegion, - LaplaceFEMKernel >( mesh, - targetRegionNames(), - this->getDiscretizationName(), - dofIndex, - dofManager.rankOffset(), - sparsityPattern ); + finiteElement::fillSparsity< CellElementSubRegion, + finiteElement::SparsityKernelDispatch< JITTI_TPARAM( LaplaceFEMKernel ) > >( "geosx::LaplaceFEMKernel", + mesh, + targetRegionNames(), + this->getDiscretizationName(), + dofIndex, + dofManager.rankOffset(), + sparsityPattern ); sparsityPattern.compress(); localMatrix.assimilate< parallelDevicePolicy<> >( std::move( sparsityPattern ) ); @@ -153,8 +154,12 @@ void LaplaceFEM::assembleSystem( real64 const GEOSX_UNUSED_PARAM( time_n ), arrayView1d< globalIndex const > const & dofIndex = nodeManager.getReference< array1d< globalIndex > >( dofKey ); + //LaplaceFEMKernelFactory kernelFactory( dofIndex, dofManager.rankOffset(), localMatrix, localRhs, m_fieldName ); + // finiteElement::KernelDispatch kernelDispatch< arrayView1d< globalIndex const > const &, + // globalIndex, CRSMatrixView< real64, globalIndex const > const &, + // arrayView1d< real64 > const &, string const & >( "geosx::LaplaceFEMKernel" ); - LaplaceFEMKernelFactory kernelFactory( dofIndex, dofManager.rankOffset(), localMatrix, localRhs, m_fieldName ); + LaplaceFEMKernelDispatch kernelDispatch( "geosx::LaplaceFEMKernel", dofIndex, dofManager.rankOffset(), localMatrix, localRhs, m_fieldName ); finiteElement:: regionBasedKernelApplication< parallelDevicePolicy< 32 >, @@ -163,7 +168,7 @@ void LaplaceFEM::assembleSystem( real64 const GEOSX_UNUSED_PARAM( time_n ), targetRegionNames(), this->getDiscretizationName(), arrayView1d< string const >(), - kernelFactory ); + kernelDispatch ); } //END_SPHINX_INCLUDE_ASSEMBLY diff --git a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp index e47f7b6c976..cc40339e661 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp @@ -246,10 +246,12 @@ class LaplaceFEMKernel : }; /// The factory used to construct a LaplaceFEMKernel. -using LaplaceFEMKernelFactory = finiteElement::KernelFactory< LaplaceFEMKernel, - arrayView1d< globalIndex const > const &, - globalIndex, CRSMatrixView< real64, globalIndex const > const &, - arrayView1d< real64 > const &, string const & >; +using LaplaceFEMKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( LaplaceFEMKernel ), + arrayView1d< globalIndex const > const &, + globalIndex, + CRSMatrixView< real64, globalIndex const > const &, + arrayView1d< real64 > const &, + string const & >; } // namespace geosx diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp index 3456ced566f..4c84f1dbcbd 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp @@ -229,12 +229,13 @@ void PhaseFieldDamageFEM::assembleSystem( real64 const GEOSX_UNUSED_PARAM( time_ localMatrix.zero(); localRhs.zero(); - PhaseFieldDamageKernelFactory kernelFactory( dofIndex, - dofManager.rankOffset(), - localMatrix, - localRhs, - m_fieldName, - m_localDissipationOption=="Linear" ? 1 : 2 ); + PhaseFieldDamageKernelDispatch kernelDispatch( "geosx::PhaseFieldDamageKernel", + dofIndex, + dofManager.rankOffset(), + localMatrix, + localRhs, + m_fieldName, + m_localDissipationOption=="Linear" ? 1 : 2 ); finiteElement:: regionBasedKernelApplication< parallelDevicePolicy<>, @@ -243,7 +244,7 @@ void PhaseFieldDamageFEM::assembleSystem( real64 const GEOSX_UNUSED_PARAM( time_ targetRegionNames(), this->getDiscretizationName(), m_solidModelNames, - kernelFactory ); + kernelDispatch ); #else // this has your changes to the old base code matrix.zero(); rhs.zero(); diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp index fc3472538c3..6cfff56e5fb 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp @@ -287,13 +287,13 @@ class PhaseFieldDamageKernel : }; -using PhaseFieldDamageKernelFactory = finiteElement::KernelFactory< PhaseFieldDamageKernel, - arrayView1d< globalIndex const > const &, - globalIndex, - CRSMatrixView< real64, globalIndex const > const &, - arrayView1d< real64 > const &, - string const &, - int >; +using PhaseFieldDamageKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( PhaseFieldDamageKernel ), + arrayView1d< globalIndex const > const &, + globalIndex, + CRSMatrixView< real64, globalIndex const > const &, + arrayView1d< real64 > const &, + string const &, + int >; } // namespace geosx diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp index a7a2e05bd05..0e6c9478d4a 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp @@ -475,14 +475,14 @@ class QuasiStatic : }; /// The factory used to construct a QuasiStatic kernel. -using QuasiStaticFactory = finiteElement::KernelFactory< QuasiStatic, - EmbeddedSurfaceSubRegion const &, - arrayView1d< globalIndex const > const &, - arrayView1d< globalIndex const > const &, - globalIndex const, - CRSMatrixView< real64, globalIndex const > const &, - arrayView1d< real64 > const &, - real64 const (&) [3] >; +using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( QuasiStatic ), + EmbeddedSurfaceSubRegion const &, + arrayView1d< globalIndex const > const &, + arrayView1d< globalIndex const > const &, + globalIndex const, + CRSMatrixView< real64, globalIndex const > const &, + arrayView1d< real64 > const &, + real64 const (&) [3] >; } // namespace SolidMechanicsEFEMKernels diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp index 08240d937d9..dd0819612f3 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp @@ -274,13 +274,14 @@ void SolidMechanicsEmbeddedFractures::assembleSystem( real64 const time, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - SolidMechanicsEFEMKernels::QuasiStaticFactory kernelFactory( subRegion, - dispDofNumber, - jumpDofNumber, - dofManager.rankOffset(), - localMatrix, - localRhs, - gravityVectorData ); + SolidMechanicsEFEMKernels::QuasiStaticDispatch kernelDispatch( "geosx::Quasistatic", + subRegion, + dispDofNumber, + jumpDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + gravityVectorData ); real64 maxTraction = finiteElement:: regionBasedKernelApplication @@ -290,7 +291,7 @@ void SolidMechanicsEmbeddedFractures::assembleSystem( real64 const time, targetRegionNames(), m_solidSolver->getDiscretizationName(), m_solidSolver->solidMaterialNames(), - kernelFactory ); + kernelDispatch ); GEOSX_UNUSED_VAR( maxTraction ); } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp index 714142db5f7..e306c4628b9 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp @@ -200,9 +200,9 @@ class ExplicitFiniteStrain : public ExplicitSmallStrain< SUBREGION_TYPE, #undef UPDATE_STRESS /// The factory used to construct a ExplicitFiniteStrain kernel. -using ExplicitFiniteStrainFactory = finiteElement::KernelFactory< ExplicitFiniteStrain, - real64, - string const & >; +using ExplicitFiniteStrainDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( ExplicitFiniteStrain ), + real64, + string const & >; } // namespace SolidMechanicsLagrangianFEMKernels diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 9e5d085d4f7..537844cd7b0 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -267,7 +267,7 @@ real64 SolidMechanicsLagrangianFEM::explicitKernelDispatch( MeshLevel & mesh, real64 rval = 0; if( m_strainTheory==0 ) { - auto kernelFactory = SolidMechanicsLagrangianFEMKernels::ExplicitSmallStrainFactory( dt, elementListName ); + auto kernelDispatch = SolidMechanicsLagrangianFEMKernels::ExplicitSmallStrainDispatch( "geosx::ExplicitSmallStrain", dt, elementListName ); rval = finiteElement:: regionBasedKernelApplication< parallelDevicePolicy< 32 >, constitutive::SolidBase, @@ -275,11 +275,11 @@ real64 SolidMechanicsLagrangianFEM::explicitKernelDispatch( MeshLevel & mesh, targetRegions, finiteElementName, constitutiveNames, - kernelFactory ); + kernelDispatch ); } else if( m_strainTheory==1 ) { - auto kernelFactory = SolidMechanicsLagrangianFEMKernels::ExplicitFiniteStrainFactory( dt, elementListName ); + auto kernelDispatch = SolidMechanicsLagrangianFEMKernels::ExplicitFiniteStrainDispatch( "geosx::ExplicitFiniteStraing", dt, elementListName ); rval = finiteElement:: regionBasedKernelApplication< parallelDevicePolicy< 32 >, constitutive::SolidBase, @@ -287,7 +287,7 @@ real64 SolidMechanicsLagrangianFEM::explicitKernelDispatch( MeshLevel & mesh, targetRegions, finiteElementName, constitutiveNames, - kernelFactory ); + kernelDispatch ); } else { @@ -952,22 +952,25 @@ void SolidMechanicsLagrangianFEM::setupSystem( DomainPartition & domain, finiteElement:: fillSparsity< FaceElementSubRegion, - SolidMechanicsLagrangianFEMKernels::QuasiStatic >( mesh, - allFaceElementRegions, - this->getDiscretizationName(), - dofNumber, - dofManager.rankOffset(), - sparsityPattern ); - + finiteElement::SparsityKernelDispatch< JITTI_TPARAM( SolidMechanicsLagrangianFEMKernels::QuasiStatic ) > > + ( "geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic", + mesh, + allFaceElementRegions, + this->getDiscretizationName(), + dofNumber, + dofManager.rankOffset(), + sparsityPattern ); } finiteElement:: fillSparsity< CellElementSubRegion, - SolidMechanicsLagrangianFEMKernels::QuasiStatic >( mesh, - targetRegionNames(), - this->getDiscretizationName(), - dofNumber, - dofManager.rankOffset(), - sparsityPattern ); + finiteElement::SparsityKernelDispatch< JITTI_TPARAM( SolidMechanicsLagrangianFEMKernels::QuasiStatic ) > > + ( "geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic", + mesh, + targetRegionNames(), + this->getDiscretizationName(), + dofNumber, + dofManager.rankOffset(), + sparsityPattern ); sparsityPattern.compress(); localMatrix.assimilate< parallelDevicePolicy<> >( std::move( sparsityPattern ) ); @@ -991,23 +994,25 @@ void SolidMechanicsLagrangianFEM::assembleSystem( real64 const GEOSX_UNUSED_PARA { GEOSX_UNUSED_VAR( dt ); assemblyLaunch< constitutive::SolidBase, - SolidMechanicsLagrangianFEMKernels::QuasiStaticFactory >( domain, - dofManager, - localMatrix, - localRhs ); + SolidMechanicsLagrangianFEMKernels::QuasiStaticDispatch >( "geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic", + domain, + dofManager, + localMatrix, + localRhs ); } else if( m_timeIntegrationOption == TimeIntegrationOption::ImplicitDynamic ) { assemblyLaunch< constitutive::SolidBase, - SolidMechanicsLagrangianFEMKernels::ImplicitNewmarkFactory >( domain, - dofManager, - localMatrix, - localRhs, - m_newmarkGamma, - m_newmarkBeta, - m_massDamping, - m_stiffnessDamping, - dt ); + SolidMechanicsLagrangianFEMKernels::ImplicitNewmarkDispatch >( "geosx::SolidMechanicsLagrangianFEMKernels::ImplicitNewmark", + domain, + dofManager, + localMatrix, + localRhs, + m_newmarkGamma, + m_newmarkBeta, + m_massDamping, + m_stiffnessDamping, + dt ); } if( getLogLevel() >= 2 ) diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp index 1cc23e52757..faa7b12aab2 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp @@ -163,7 +163,8 @@ class SolidMechanicsLagrangianFEM : public SolverBase template< typename CONSTITUTIVE_BASE, typename KERNEL_WRAPPER, typename ... PARAMS > - void assemblyLaunch( DomainPartition & domain, + void assemblyLaunch( string const & kernelClass, + DomainPartition & domain, DofManager const & dofManager, CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs, @@ -308,7 +309,8 @@ ENUM_STRINGS( SolidMechanicsLagrangianFEM::TimeIntegrationOption, template< typename CONSTITUTIVE_BASE, typename KERNEL_WRAPPER, typename ... PARAMS > -void SolidMechanicsLagrangianFEM::assemblyLaunch( DomainPartition & domain, +void SolidMechanicsLagrangianFEM::assemblyLaunch( string const & kernelClass, + DomainPartition & domain, DofManager const & dofManager, CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs, @@ -324,7 +326,8 @@ void SolidMechanicsLagrangianFEM::assemblyLaunch( DomainPartition & domain, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - KERNEL_WRAPPER kernelWrapper( dofNumber, + KERNEL_WRAPPER kernelWrapper( kernelClass, + dofNumber, dofManager.rankOffset(), localMatrix, localRhs, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp index 3a480b1aed7..9948f545a6d 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp @@ -340,9 +340,9 @@ class ExplicitSmallStrain : public finiteElement::KernelBase< SUBREGION_TYPE, #undef UPDATE_STRESS /// The factory used to construct a ExplicitSmallStrain kernel. -using ExplicitSmallStrainFactory = finiteElement::KernelFactory< ExplicitSmallStrain, - real64, - string const & >; +using ExplicitSmallStrainDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( ExplicitSmallStrain ), + real64, + string const & >; } // namespace SolidMechanicsLagrangianFEMKernels diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp index d9d968c55f8..c40c7cc0a4d 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp @@ -292,17 +292,17 @@ class ImplicitNewmark : public QuasiStatic< SUBREGION_TYPE, }; /// The factory used to construct a ImplicitNewmark kernel. -using ImplicitNewmarkFactory = finiteElement::KernelFactory< ImplicitNewmark, - arrayView1d< globalIndex const > const &, - globalIndex, - CRSMatrixView< real64, globalIndex const > const &, - arrayView1d< real64 > const &, - real64 const (&)[3], - real64, - real64, - real64, - real64, - real64 >; +using ImplicitNewmarkDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( ImplicitNewmark ), + arrayView1d< globalIndex const > const &, + globalIndex, + CRSMatrixView< real64, globalIndex const > const &, + arrayView1d< real64 > const &, + real64 const (&)[3], + real64, + real64, + real64, + real64, + real64 >; } // namespace SolidMechanicsLagrangianFEMKernels diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp index a5fd9e9d7be..0e394768fab 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp @@ -329,12 +329,12 @@ class QuasiStatic : }; /// The factory used to construct a QuasiStatic kernel. -using QuasiStaticFactory = finiteElement::KernelFactory< QuasiStatic, - arrayView1d< globalIndex const > const &, - globalIndex, - CRSMatrixView< real64, globalIndex const > const &, - arrayView1d< real64 > const &, - real64 const (&)[3] >; +using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( QuasiStatic ), + arrayView1d< globalIndex const > const &, + globalIndex, + CRSMatrixView< real64, globalIndex const > const &, + arrayView1d< real64 > const &, + real64 const (&)[3] >; } // namespace SolidMechanicsLagrangianFEMKernels From 599f4ca1feba06f595595e14f4b21fda839e050e Mon Sep 17 00:00:00 2001 From: wrtobin Date: Thu, 26 Aug 2021 09:40:48 -0700 Subject: [PATCH 02/10] switching to full JIT and doing some small cleanup --- .../finiteElement/kernelInterface/KernelBase.hpp | 7 ++++--- .../kernelInterface/SparsityKernelBase.hpp | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp index 3301081a993..b9d24d506ca 100644 --- a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp @@ -296,9 +296,10 @@ class KernelBase return KERNEL_TYPE::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernel ); } +#define JITTI 1 // cpp20 should allow some simplification here, since prior to that string literals can't be used as value template params // and camp doesn't appear to have a mechanism to mitigate this -#if JITTI +#if JITTI == 1 #define JITTI_TPARAM( X ) std::nullptr_t #define KernelDispatch KernelJITDispatch #else @@ -367,10 +368,10 @@ class KernelBase }; // compiles the kernel using jitti caching - template < std::nullptr_t, typename ... ARGS > + template < typename _, typename ... ARGS > class KernelJITDispatch { - + public: /** * @brief Initialize the factory. * @param args The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. diff --git a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp index 08caf4a97f8..94644fe8128 100644 --- a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp @@ -189,8 +189,9 @@ real64 buildSparsityAndInvoke( localIndex const numElems, globalIndex const rankOffset, SparsityPattern< globalIndex > & inputSparsityPattern ) { - // this requires the underlying kernel be fully specified and instantiated.. which means we'll compile it - // to avoid this we'll have to JIT a function that handles + // this requires the underlying kernel be fully specified.. which should result in it compiling, thus sparsity needs to be jitted as well + // if we could move the numDofPerXXX out of the kernel classes and have a different mechanism to specify them without full specifying the kernel + // class we could get away without jitting the sparsity as well using Kernel = KERNEL_TEMPLATE< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE >; using SPARSITY_KERNEL_TYPE = SparsityKernelBase< SUBREGION_TYPE, CONSTITUTIVE_TYPE, FE_TYPE, Kernel::numDofPerTestSupportPoint, Kernel::numDofPerTrialSupportPoint >; SPARSITY_KERNEL_TYPE kernel ( nodeManager, @@ -206,7 +207,8 @@ real64 buildSparsityAndInvoke( localIndex const numElems, return SPARSITY_KERNEL_TYPE::template kernelLaunch< POLICY, SPARSITY_KERNEL_TYPE >( numElems, kernel ); } -#if JITTI +#define JITTI 1 +#if JITTI == 1 #define SparsityKernelDispatch SparsityKernelJITDispatch #else #define SparsityKernelDispatch SparsityKernelTemplateDispatch @@ -305,9 +307,7 @@ class SparsityKernelTemplateDispatch * @tparam KERNEL_TEMPLATE Templated class that defines the physics kernel. * Most likely derives from SparsityKernelBase. */ -template< template< typename, - typename, - typename > class KERNEL_TEMPLATE > +template < typename _ > class SparsityKernelJITDispatch { public: From c340fa41a345521e3f4895daaed6b1f184bf7856 Mon Sep 17 00:00:00 2001 From: wrtobin Date: Mon, 30 Aug 2021 10:50:21 -0700 Subject: [PATCH 03/10] attempted unifying jit/template classes into a single specialized class to avoid cumbersome preprocessor usage, only managed to remove the kernel name string from the arglist, which at least enforces the name being correct --- .../kernelInterface/KernelBase.hpp | 44 +++++++++---------- .../kernelInterface/SparsityKernelBase.hpp | 38 +++++++--------- .../MultiphasePoromechanicsKernel.hpp | 3 +- .../MultiphasePoromechanicsSolver.cpp | 3 +- .../SinglePhasePoromechanicsKernel.hpp | 5 ++- .../SinglePhasePoromechanicsSolver.cpp | 3 +- .../physicsSolvers/simplePDE/LaplaceFEM.cpp | 5 +-- .../simplePDE/LaplaceFEMKernels.hpp | 7 ++- .../simplePDE/PhaseFieldDamageFEM.cpp | 13 +++--- .../simplePDE/PhaseFieldDamageFEMKernels.hpp | 3 +- .../SolidMechanicsEFEMKernels.hpp | 3 +- .../SolidMechanicsEmbeddedFractures.cpp | 15 +++---- .../SolidMechanicsLagrangianFEM.cpp | 22 ++++------ .../SolidMechanicsLagrangianFEM.hpp | 9 ++-- ...dMechanicsSmallStrainQuasiStaticKernel.hpp | 6 ++- 15 files changed, 84 insertions(+), 95 deletions(-) diff --git a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp index b9d24d506ca..4cc0ae4be47 100644 --- a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp @@ -296,17 +296,6 @@ class KernelBase return KERNEL_TYPE::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernel ); } -#define JITTI 1 -// cpp20 should allow some simplification here, since prior to that string literals can't be used as value template params -// and camp doesn't appear to have a mechanism to mitigate this -#if JITTI == 1 - #define JITTI_TPARAM( X ) std::nullptr_t - #define KernelDispatch KernelJITDispatch -#else - #define JITTI_TPARAM( X ) X - #define KernelDispatch KernelTemplateDispatch -#endif - jitti::CompilationInfo getKernelCompilationInfo( ); /** @@ -315,9 +304,8 @@ class KernelBase * @tparam KERNEL_TYPE The template class to construct, should implement the KernelBase interface. * @tparam ARGS The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. */ - // template< typename KernelClass > // subclass on typename vs const char * which will do the JIT - template< template < typename SUBREGION_TYPE, typename CONSTITUTIVE_TYPE, typename FE_TYPE > class KERNEL_TYPE, typename ... ARGS > - class KernelTemplateDispatch + template < template < typename CONSTITUTIVE_TYPE, typename SUBREGION_TYPE, typename FE_TYPE > class KERNEL_TYPE, typename ... ARGS > + class KernelDispatchTemplate { public: @@ -325,8 +313,7 @@ class KernelBase * @brief Initialize the factory. * @param args The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. */ - KernelTemplateDispatch( string const & scopedKernelName, ARGS ... args ): - m_kernelName( scopedKernelName ), + KernelDispatchTemplate( ARGS ... args ): m_args( args ... ) {} @@ -362,22 +349,20 @@ class KernelBase private: - string const m_kernelName; /// The arguments to append to the standard kernel constructor arguments. camp::tuple< ARGS ... > m_args; }; - // compiles the kernel using jitti caching - template < typename _, typename ... ARGS > - class KernelJITDispatch + // compiles the kernel using jitti + template < const char * NAME, typename ... ARGS > + class KernelDispatchJIT { public: /** * @brief Initialize the factory. * @param args The arguments used to construct a @p KERNEL_TYPE in addition to the standard arguments. */ - KernelJITDispatch( string const & scopedKernelName, ARGS ... args ): - m_kernelName( scopedKernelName ), + KernelDispatchJIT( ARGS ... args ): m_args( args ... ) {} @@ -400,7 +385,7 @@ class KernelBase LvArray::system::demangleType< SUBREGION_TYPE >() + ", " + LvArray::system::demangleType< CONSTITUTIVE_TYPE >() + ", " + LvArray::system::demangleType< FE_TYPE >() + ", " + - m_kernelName + + string( NAME ) + ", " + LvArray::system::demangleType< decltype( m_args ) >(); // Unfortunately can't just decltype(&buildKernelAndInvoke) since we can't fully specify the function template @@ -431,11 +416,22 @@ class KernelBase private: - string const m_kernelName; /// The arguments to append to the standard kernel constructor arguments. camp::tuple< ARGS ... > m_args; }; +// Would VASTLY prefer to use template specialization on the above class(es) and allow JITTI_TPARAM to ultimately +// decide on whether to JIT or not.. but current language restrictions on templating and our in-code restrictions on +// the kernels due to the 'using' statements throughout the code to define specific kernel dispatchers make that +// devwork intractable. +// We can't use 'using' here due to differences in the above templates as well... nor a nice preprocessor macro... +// so we're basically left with only one option +#if JITTI == 1 + #define KernelDispatch KernelDispatchJIT +#else + #define KernelDispatch KernelDispatchTemplate +#endif + //***************************************************************************** //***************************************************************************** //***************************************************************************** diff --git a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp index 94644fe8128..37489e01981 100644 --- a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp @@ -207,13 +207,6 @@ real64 buildSparsityAndInvoke( localIndex const numElems, return SPARSITY_KERNEL_TYPE::template kernelLaunch< POLICY, SPARSITY_KERNEL_TYPE >( numElems, kernel ); } -#define JITTI 1 -#if JITTI == 1 - #define SparsityKernelDispatch SparsityKernelJITDispatch -#else - #define SparsityKernelDispatch SparsityKernelTemplateDispatch -#endif - jitti::CompilationInfo getSparsityCompilationInfo( ); @@ -226,7 +219,7 @@ jitti::CompilationInfo getSparsityCompilationInfo( ); template< template< typename, typename, typename > class KERNEL_TEMPLATE > -class SparsityKernelTemplateDispatch +class SparsityKernelDispatchTemplate { public: @@ -236,11 +229,9 @@ class SparsityKernelTemplateDispatch * @param rankOffset The global rank offset. * @param inputSparsityPattern The local sparsity pattern. */ - SparsityKernelTemplateDispatch( string const & scopedKernelName, - arrayView1d< globalIndex const > const & inputDofNumber, + SparsityKernelDispatchTemplate( arrayView1d< globalIndex const > const & inputDofNumber, globalIndex const rankOffset, SparsityPattern< globalIndex > & inputSparsityPattern ): - m_kernelName( scopedKernelName ), m_inputDofNumber( inputDofNumber ), m_rankOffset( rankOffset ), m_inputSparsityPattern( inputSparsityPattern ) @@ -291,7 +282,7 @@ class SparsityKernelTemplateDispatch } private: - string const m_kernelName; + /// The input degree of freedom numbers. arrayView1d< globalIndex const > const & m_inputDofNumber; /// The global rank offset. @@ -307,8 +298,8 @@ class SparsityKernelTemplateDispatch * @tparam KERNEL_TEMPLATE Templated class that defines the physics kernel. * Most likely derives from SparsityKernelBase. */ -template < typename _ > -class SparsityKernelJITDispatch +template < const char * NAME > +class SparsityKernelDispatchJIT { public: @@ -318,11 +309,9 @@ class SparsityKernelJITDispatch * @param rankOffset The global rank offset. * @param inputSparsityPattern The local sparsity pattern. */ - SparsityKernelJITDispatch( string const & scopedKernelName, - arrayView1d< globalIndex const > const & inputDofNumber, + SparsityKernelDispatchJIT( arrayView1d< globalIndex const > const & inputDofNumber, globalIndex const rankOffset, SparsityPattern< globalIndex > & inputSparsityPattern ): - m_kernelName( scopedKernelName ), m_inputDofNumber( inputDofNumber ), m_rankOffset( rankOffset ), m_inputSparsityPattern( inputSparsityPattern ) @@ -360,7 +349,7 @@ class SparsityKernelJITDispatch LvArray::system::demangleType< SUBREGION_TYPE >() + ", " + LvArray::system::demangleType< CONSTITUTIVE_TYPE >() + ", " + LvArray::system::demangleType< FE_TYPE >() + ", " + - m_kernelName; + string( NAME ); // Unfortunately can't just decltype(&buildSparsityAndInvoke) since we can't fully specify the function template using JIT_SPARSITY_DISPATCH = real64(*)( localIndex const, NodeManager const &, @@ -392,7 +381,7 @@ class SparsityKernelJITDispatch } private: - string const m_kernelName; + /// The input degree of freedom numbers. arrayView1d< globalIndex const > const & m_inputDofNumber; /// The global rank offset. @@ -401,6 +390,12 @@ class SparsityKernelJITDispatch SparsityPattern< globalIndex > & m_inputSparsityPattern; }; +#if JITTI == 1 + #define SparsityKernelDispatch SparsityKernelDispatchJIT +#else + #define SparsityKernelDispatch SparsityKernelDispatchTemplate +#endif + //***************************************************************************** //***************************************************************************** //***************************************************************************** @@ -428,8 +423,7 @@ class SparsityKernelJITDispatch template< typename REGION_TYPE, typename KERNEL_WRAPPER > static -real64 fillSparsity( string const & kernelName, - MeshLevel & mesh, +real64 fillSparsity( MeshLevel & mesh, arrayView1d< string const > const & targetRegions, string const & discretizationName, arrayView1d< globalIndex const > const & inputDofNumber, @@ -438,7 +432,7 @@ real64 fillSparsity( string const & kernelName, { GEOSX_MARK_FUNCTION; - KERNEL_WRAPPER kernelDispatch( kernelName, inputDofNumber, rankOffset, inputSparsityPattern ); + KERNEL_WRAPPER kernelDispatch( inputDofNumber, rankOffset, inputSparsityPattern ); regionBasedKernelApplication< serialPolicy, constitutive::NullModel, diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp index 1173a90e801..952834b7eea 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp @@ -577,7 +577,8 @@ class Multiphase : localIndex const m_numPhases; }; -using MultiphaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( Multiphase ), +JITTI_NAME( geosx::PoromechanicsKernels::Multiphase ); +using MultiphaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::PoromechanicsKernels::Multiphase ), arrayView1d< globalIndex const > const &, string const &, globalIndex const, diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp index 149694ae546..9a443e736d5 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsSolver.cpp @@ -192,8 +192,7 @@ void MultiphasePoromechanicsSolver::assembleSystem( real64 const time_n, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - PoromechanicsKernels::MultiphaseKernelDispatch kernelDispatch( "geosx::Multiphase", - displacementDofNumber, + PoromechanicsKernels::MultiphaseKernelDispatch kernelDispatch( displacementDofNumber, flowDofKey, dofManager.rankOffset(), gravityVectorData, diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp index bd8eaae1535..642cc394533 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp @@ -404,7 +404,8 @@ class SinglePhase : }; -using SinglePhaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( SinglePhase ), +JITTI_NAME( geosx::PoromechanicsKernels::SinglePhase ); +using SinglePhaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::PoromechanicsKernels::SinglePhase ), arrayView1d< globalIndex const > const &, string const &, globalIndex const, @@ -413,7 +414,7 @@ using SinglePhaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( S real64 const (&)[3], arrayView1d< string const > const >; -} // namespace PoroelasticKernels +} // namespace PoromechanicsKernels } // namespace geosx diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp index 1b7fb290b7d..9404f5a8b28 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsSolver.cpp @@ -197,8 +197,7 @@ void SinglePhasePoromechanicsSolver::assembleSystem( real64 const time_n, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - PoromechanicsKernels::SinglePhaseKernelDispatch kernelDispatch( "geosx::PoromechanicsKernels::SinglePhase", - dispDofNumber, + PoromechanicsKernels::SinglePhaseKernelDispatch kernelDispatch( dispDofNumber, pDofKey, dofManager.rankOffset(), localMatrix, diff --git a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp index 67b362c91e5..eb604193c9f 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp +++ b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp @@ -109,8 +109,7 @@ void LaplaceFEM::setupSystem( DomainPartition & domain, 8*8*3 ); finiteElement::fillSparsity< CellElementSubRegion, - finiteElement::SparsityKernelDispatch< JITTI_TPARAM( LaplaceFEMKernel ) > >( "geosx::LaplaceFEMKernel", - mesh, + finiteElement::SparsityKernelDispatch< JITTI_TPARAM( LaplaceFEMKernel ) > >( mesh, targetRegionNames(), this->getDiscretizationName(), dofIndex, @@ -159,7 +158,7 @@ void LaplaceFEM::assembleSystem( real64 const GEOSX_UNUSED_PARAM( time_n ), // globalIndex, CRSMatrixView< real64, globalIndex const > const &, // arrayView1d< real64 > const &, string const & >( "geosx::LaplaceFEMKernel" ); - LaplaceFEMKernelDispatch kernelDispatch( "geosx::LaplaceFEMKernel", dofIndex, dofManager.rankOffset(), localMatrix, localRhs, m_fieldName ); + LaplaceFEMKernelDispatch kernelDispatch( dofIndex, dofManager.rankOffset(), localMatrix, localRhs, m_fieldName ); finiteElement:: regionBasedKernelApplication< parallelDevicePolicy< 32 >, diff --git a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp index cc40339e661..43bf1692afa 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp @@ -21,6 +21,7 @@ #define GEOSX_PHYSICSSOLVERS_SIMPLEPDE_LAPLACEFEMKERNELS_HPP_ #include "finiteElement/kernelInterface/ImplicitKernelBase.hpp" +#include "finiteElement/kernelInterface/SparsityKernelBase.hpp" namespace geosx { @@ -246,13 +247,17 @@ class LaplaceFEMKernel : }; /// The factory used to construct a LaplaceFEMKernel. -using LaplaceFEMKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( LaplaceFEMKernel ), +JITTI_NAME( geosx::LaplaceFEMKernel ); +using LaplaceFEMKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::LaplaceFEMKernel ), arrayView1d< globalIndex const > const &, globalIndex, CRSMatrixView< real64, globalIndex const > const &, arrayView1d< real64 > const &, string const & >; +using LaplaceSparsityDispatch = finiteElement::SparsityKernelDispatch< JITTI_TPARAM( geosx::LaplaceFEMKernel ) >; + + } // namespace geosx #include "finiteElement/kernelInterface/SparsityKernelBase.hpp" diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp index 4c84f1dbcbd..5ad2adf72c2 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp @@ -229,13 +229,12 @@ void PhaseFieldDamageFEM::assembleSystem( real64 const GEOSX_UNUSED_PARAM( time_ localMatrix.zero(); localRhs.zero(); - PhaseFieldDamageKernelDispatch kernelDispatch( "geosx::PhaseFieldDamageKernel", - dofIndex, - dofManager.rankOffset(), - localMatrix, - localRhs, - m_fieldName, - m_localDissipationOption=="Linear" ? 1 : 2 ); + PhaseFieldDamageKernelDispatch kernelDispatch( dofIndex, + dofManager.rankOffset(), + localMatrix, + localRhs, + m_fieldName, + m_localDissipationOption=="Linear" ? 1 : 2 ); finiteElement:: regionBasedKernelApplication< parallelDevicePolicy<>, diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp index 6cfff56e5fb..97e34391f13 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp @@ -287,7 +287,8 @@ class PhaseFieldDamageKernel : }; -using PhaseFieldDamageKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( PhaseFieldDamageKernel ), +JITTI_NAME( geosx::PhaseFieldDamageKernel ); +using PhaseFieldDamageKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::PhaseFieldDamageKernel ), arrayView1d< globalIndex const > const &, globalIndex, CRSMatrixView< real64, globalIndex const > const &, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp index 0e6c9478d4a..61a2e13d1cc 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp @@ -475,7 +475,8 @@ class QuasiStatic : }; /// The factory used to construct a QuasiStatic kernel. -using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( QuasiStatic ), +JITTI_NAME( geosx::SolidMechanicsEFEMKernels::QuasiStatic ) +using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::SolidMechanicsEFEMKernels::QuasiStatic ), EmbeddedSurfaceSubRegion const &, arrayView1d< globalIndex const > const &, arrayView1d< globalIndex const > const &, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp index dd0819612f3..a5d2f77bc68 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEmbeddedFractures.cpp @@ -274,14 +274,13 @@ void SolidMechanicsEmbeddedFractures::assembleSystem( real64 const time, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - SolidMechanicsEFEMKernels::QuasiStaticDispatch kernelDispatch( "geosx::Quasistatic", - subRegion, - dispDofNumber, - jumpDofNumber, - dofManager.rankOffset(), - localMatrix, - localRhs, - gravityVectorData ); + SolidMechanicsEFEMKernels::QuasiStaticDispatch kernelDispatch( subRegion, + dispDofNumber, + jumpDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + gravityVectorData ); real64 maxTraction = finiteElement:: regionBasedKernelApplication diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 537844cd7b0..79c3a2e00ec 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -267,7 +267,7 @@ real64 SolidMechanicsLagrangianFEM::explicitKernelDispatch( MeshLevel & mesh, real64 rval = 0; if( m_strainTheory==0 ) { - auto kernelDispatch = SolidMechanicsLagrangianFEMKernels::ExplicitSmallStrainDispatch( "geosx::ExplicitSmallStrain", dt, elementListName ); + auto kernelDispatch = SolidMechanicsLagrangianFEMKernels::ExplicitSmallStrainDispatch( dt, elementListName ); rval = finiteElement:: regionBasedKernelApplication< parallelDevicePolicy< 32 >, constitutive::SolidBase, @@ -279,7 +279,7 @@ real64 SolidMechanicsLagrangianFEM::explicitKernelDispatch( MeshLevel & mesh, } else if( m_strainTheory==1 ) { - auto kernelDispatch = SolidMechanicsLagrangianFEMKernels::ExplicitFiniteStrainDispatch( "geosx::ExplicitFiniteStraing", dt, elementListName ); + auto kernelDispatch = SolidMechanicsLagrangianFEMKernels::ExplicitFiniteStrainDispatch( dt, elementListName ); rval = finiteElement:: regionBasedKernelApplication< parallelDevicePolicy< 32 >, constitutive::SolidBase, @@ -951,10 +951,8 @@ void SolidMechanicsLagrangianFEM::setupSystem( DomainPartition & domain, } ); finiteElement:: - fillSparsity< FaceElementSubRegion, - finiteElement::SparsityKernelDispatch< JITTI_TPARAM( SolidMechanicsLagrangianFEMKernels::QuasiStatic ) > > - ( "geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic", - mesh, + fillSparsity< FaceElementSubRegion, SolidMechanicsLagrangianFEMKernels::QuasiStaticSparsityDispatch > + ( mesh, allFaceElementRegions, this->getDiscretizationName(), dofNumber, @@ -962,10 +960,8 @@ void SolidMechanicsLagrangianFEM::setupSystem( DomainPartition & domain, sparsityPattern ); } finiteElement:: - fillSparsity< CellElementSubRegion, - finiteElement::SparsityKernelDispatch< JITTI_TPARAM( SolidMechanicsLagrangianFEMKernels::QuasiStatic ) > > - ( "geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic", - mesh, + fillSparsity< CellElementSubRegion, SolidMechanicsLagrangianFEMKernels::QuasiStaticSparsityDispatch > + ( mesh, targetRegionNames(), this->getDiscretizationName(), dofNumber, @@ -994,8 +990,7 @@ void SolidMechanicsLagrangianFEM::assembleSystem( real64 const GEOSX_UNUSED_PARA { GEOSX_UNUSED_VAR( dt ); assemblyLaunch< constitutive::SolidBase, - SolidMechanicsLagrangianFEMKernels::QuasiStaticDispatch >( "geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic", - domain, + SolidMechanicsLagrangianFEMKernels::QuasiStaticDispatch >( domain, dofManager, localMatrix, localRhs ); @@ -1003,8 +998,7 @@ void SolidMechanicsLagrangianFEM::assembleSystem( real64 const GEOSX_UNUSED_PARA else if( m_timeIntegrationOption == TimeIntegrationOption::ImplicitDynamic ) { assemblyLaunch< constitutive::SolidBase, - SolidMechanicsLagrangianFEMKernels::ImplicitNewmarkDispatch >( "geosx::SolidMechanicsLagrangianFEMKernels::ImplicitNewmark", - domain, + SolidMechanicsLagrangianFEMKernels::ImplicitNewmarkDispatch >( domain, dofManager, localMatrix, localRhs, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp index faa7b12aab2..1cc23e52757 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp @@ -163,8 +163,7 @@ class SolidMechanicsLagrangianFEM : public SolverBase template< typename CONSTITUTIVE_BASE, typename KERNEL_WRAPPER, typename ... PARAMS > - void assemblyLaunch( string const & kernelClass, - DomainPartition & domain, + void assemblyLaunch( DomainPartition & domain, DofManager const & dofManager, CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs, @@ -309,8 +308,7 @@ ENUM_STRINGS( SolidMechanicsLagrangianFEM::TimeIntegrationOption, template< typename CONSTITUTIVE_BASE, typename KERNEL_WRAPPER, typename ... PARAMS > -void SolidMechanicsLagrangianFEM::assemblyLaunch( string const & kernelClass, - DomainPartition & domain, +void SolidMechanicsLagrangianFEM::assemblyLaunch( DomainPartition & domain, DofManager const & dofManager, CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs, @@ -326,8 +324,7 @@ void SolidMechanicsLagrangianFEM::assemblyLaunch( string const & kernelClass, real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - KERNEL_WRAPPER kernelWrapper( kernelClass, - dofNumber, + KERNEL_WRAPPER kernelWrapper( dofNumber, dofManager.rankOffset(), localMatrix, localRhs, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp index 0e394768fab..a8115448e37 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp @@ -19,6 +19,7 @@ #ifndef GEOSX_PHYSICSSOLVERS_SOLIDMECHANICS_SOLIDMECHANICSSMALLSTRAINQUASISTATIC_HPP_ #define GEOSX_PHYSICSSOLVERS_SOLIDMECHANICS_SOLIDMECHANICSSMALLSTRAINQUASISTATIC_HPP_ #include "finiteElement/kernelInterface/ImplicitKernelBase.hpp" +#include "finiteElement/kernelInterface/SparsityKernelBase.hpp" namespace geosx { @@ -329,13 +330,16 @@ class QuasiStatic : }; /// The factory used to construct a QuasiStatic kernel. -using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( QuasiStatic ), +JITTI_NAME( geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ); +using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ), arrayView1d< globalIndex const > const &, globalIndex, CRSMatrixView< real64, globalIndex const > const &, arrayView1d< real64 > const &, real64 const (&)[3] >; +using QuasiStaticSparsityDispatch = finiteElement::SparsityKernelDispatch< JITTI_TPARAM( geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ) >; + } // namespace SolidMechanicsLagrangianFEMKernels } // namespace geosx From 301734c916521d61e72b169f7b1d2aa8a8fb5599 Mon Sep 17 00:00:00 2001 From: wrtobin Date: Mon, 30 Aug 2021 16:41:19 -0700 Subject: [PATCH 04/10] adding header info to template params, needed for compilation, basic sedov 1-rank passing --- .../finiteElement/CMakeLists.txt | 2 +- .../kernelInterface/KernelBase.hpp | 22 +++++++++++++------ .../kernelInterface/SparsityKernelBase.hpp | 12 +++++----- .../MultiphasePoromechanicsKernel.hpp | 4 ++-- .../SinglePhasePoromechanicsKernel.hpp | 4 ++-- .../physicsSolvers/simplePDE/LaplaceFEM.cpp | 12 +++++----- .../simplePDE/LaplaceFEMKernels.hpp | 6 ++--- .../simplePDE/PhaseFieldDamageFEMKernels.hpp | 4 ++-- .../SolidMechanicsEFEMKernels.hpp | 4 ++-- ...anicsFiniteStrainExplicitNewmarkKernel.hpp | 3 ++- ...hanicsSmallStrainExplicitNewmarkKernel.hpp | 3 ++- ...hanicsSmallStrainImplicitNewmarkKernel.hpp | 3 ++- ...dMechanicsSmallStrainQuasiStaticKernel.hpp | 6 ++--- 13 files changed, 48 insertions(+), 37 deletions(-) diff --git a/src/coreComponents/finiteElement/CMakeLists.txt b/src/coreComponents/finiteElement/CMakeLists.txt index 18a021d595e..8182b1712fa 100644 --- a/src/coreComponents/finiteElement/CMakeLists.txt +++ b/src/coreComponents/finiteElement/CMakeLists.txt @@ -39,7 +39,7 @@ endif() blt_add_library( NAME finiteElement SOURCES ${finiteElement_sources} HEADERS ${finiteElement_headers} - DEFINES JITTI_OUTPUT_DIR="${CMAKE_BINARY_DIR}/lib/jitti" + DEFINES JITTI_OUTPUT_DIR=${CMAKE_BINARY_DIR}/lib/jitti DEPENDS_ON ${dependencyList} jitti OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) diff --git a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp index 4cc0ae4be47..876c9febf85 100644 --- a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp @@ -27,6 +27,7 @@ #include "mesh/MeshLevel.hpp" #include "mesh/ElementRegionManager.hpp" #include "common/GEOS_RAJA_Interface.hpp" +#include "common/MpiWrapper.hpp" #include "LvArray/src/jitti/Cache.hpp" namespace geosx @@ -296,8 +297,6 @@ class KernelBase return KERNEL_TYPE::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernel ); } - jitti::CompilationInfo getKernelCompilationInfo( ); - /** * @class KernelTemplateDispatch * @brief Used to forward arguments to a class that implements the KernelBase interface. @@ -353,8 +352,10 @@ class KernelBase camp::tuple< ARGS ... > m_args; }; + jitti::CompilationInfo getKernelCompilationInfo( const string & header ); // compiles the kernel using jitti - template < const char * NAME, typename ... ARGS > + template < const char * NAME, const char * HEADER, typename ... ARGS > + //template < template < const char * NAME, const char * HEADER > class constexpr_jitti_info< NAME, HEADER > CONSTEXPR_INFO, typename ... ARGS > class KernelDispatchJIT { public: @@ -378,8 +379,9 @@ class KernelBase SUBREGION_TYPE const & elementSubRegion, FE_TYPE const & finiteElementSpace, CONSTITUTIVE_TYPE & inputConstitutiveType ) - { - jitti::CompilationInfo info = getKernelCompilationInfo( ); + { + string header( HEADER ); + jitti::CompilationInfo info = getKernelCompilationInfo( header ); info.templateParams = LvArray::system::demangleType< POLICY >() + ", " + LvArray::system::demangleType< SUBREGION_TYPE >() + ", " + @@ -396,11 +398,17 @@ class KernelBase localIndex const, SUBREGION_TYPE const &, FE_TYPE const &, - CONSTITUTIVE_TYPE const &, + CONSTITUTIVE_TYPE &, decltype( m_args ) const & ); - string outputDir(JITTI_OUTPUT_DIR); + string outputDir( STRINGIZE( JITTI_OUTPUT_DIR ) ); outputDir += "/"; static jitti::Cache< JIT_KERNEL_DISPATCH > buildCache( time(NULL), outputDir ); + + if( MpiWrapper::commRank( ) == 0 ) + { + buildCache.getOrLoadOrCompile( info ); + } + MpiWrapper::barrier( ); auto & jitKernelDispatch = buildCache.getOrLoadOrCompile( info ); return jitKernelDispatch( numElems, diff --git a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp index 37489e01981..3e88eb7eb85 100644 --- a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp @@ -207,9 +207,6 @@ real64 buildSparsityAndInvoke( localIndex const numElems, return SPARSITY_KERNEL_TYPE::template kernelLaunch< POLICY, SPARSITY_KERNEL_TYPE >( numElems, kernel ); } -jitti::CompilationInfo getSparsityCompilationInfo( ); - - /** * @brief Helper struct to define a specialization of * #::geosx::finiteElement::SparsityKernelBase that may be used to generate the sparsity pattern. @@ -292,13 +289,15 @@ class SparsityKernelDispatchTemplate }; +jitti::CompilationInfo getSparsityCompilationInfo( const string & ); + /** * @brief Helper struct to define a specialization of * #::geosx::finiteElement::SparsityKernelBase that may be used to generate the sparsity pattern. * @tparam KERNEL_TEMPLATE Templated class that defines the physics kernel. * Most likely derives from SparsityKernelBase. */ -template < const char * NAME > +template < const char * NAME, const char * HEADER > class SparsityKernelDispatchJIT { public: @@ -344,7 +343,8 @@ class SparsityKernelDispatchJIT FE_TYPE const & finiteElementSpace, CONSTITUTIVE_TYPE & inputConstitutiveType ) { - jitti::CompilationInfo info = getSparsityCompilationInfo(); + string header( HEADER ); + jitti::CompilationInfo info = getSparsityCompilationInfo( header ); info.templateParams = LvArray::system::demangleType< POLICY >() + ", " + LvArray::system::demangleType< SUBREGION_TYPE >() + ", " + LvArray::system::demangleType< CONSTITUTIVE_TYPE >() + ", " + @@ -362,7 +362,7 @@ class SparsityKernelDispatchJIT arrayView1d< globalIndex const > const &, globalIndex const, SparsityPattern< globalIndex > & ); - string outputDir( JITTI_OUTPUT_DIR ); + string outputDir( STRINGIZE( JITTI_OUTPUT_DIR ) ); outputDir += "/"; static jitti::Cache< JIT_SPARSITY_DISPATCH > buildCache( time(NULL), outputDir ); auto & jitSparsityDispatch = buildCache.getOrLoadOrCompile( info ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp index 952834b7eea..03b1c7b199e 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp @@ -577,8 +577,8 @@ class Multiphase : localIndex const m_numPhases; }; -JITTI_NAME( geosx::PoromechanicsKernels::Multiphase ); -using MultiphaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::PoromechanicsKernels::Multiphase ), +JITTI_DECL( multiphaseJIT, geosx::PoromechanicsKernels::Multiphase, __FILE__ ); +using MultiphaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( multiphaseJIT, geosx::PoromechanicsKernels::Multiphase ), arrayView1d< globalIndex const > const &, string const &, globalIndex const, diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp index 642cc394533..a326629d184 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp @@ -404,8 +404,8 @@ class SinglePhase : }; -JITTI_NAME( geosx::PoromechanicsKernels::SinglePhase ); -using SinglePhaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::PoromechanicsKernels::SinglePhase ), +JITTI_DECL( singlePhaseJIT, geosx::PoromechanicsKernels::SinglePhase, __FILE__ ); +using SinglePhaseKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( singlePhaseJIT, geosx::PoromechanicsKernels::SinglePhase ), arrayView1d< globalIndex const > const &, string const &, globalIndex const, diff --git a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp index eb604193c9f..76751d87ca4 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp +++ b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEM.cpp @@ -109,12 +109,12 @@ void LaplaceFEM::setupSystem( DomainPartition & domain, 8*8*3 ); finiteElement::fillSparsity< CellElementSubRegion, - finiteElement::SparsityKernelDispatch< JITTI_TPARAM( LaplaceFEMKernel ) > >( mesh, - targetRegionNames(), - this->getDiscretizationName(), - dofIndex, - dofManager.rankOffset(), - sparsityPattern ); + LaplaceSparsityDispatch >( mesh, + targetRegionNames(), + this->getDiscretizationName(), + dofIndex, + dofManager.rankOffset(), + sparsityPattern ); sparsityPattern.compress(); localMatrix.assimilate< parallelDevicePolicy<> >( std::move( sparsityPattern ) ); diff --git a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp index 43bf1692afa..152e478c531 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/simplePDE/LaplaceFEMKernels.hpp @@ -247,15 +247,15 @@ class LaplaceFEMKernel : }; /// The factory used to construct a LaplaceFEMKernel. -JITTI_NAME( geosx::LaplaceFEMKernel ); -using LaplaceFEMKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::LaplaceFEMKernel ), +JITTI_DECL( laplaceFEMKernelJIT, geosx::LaplaceFEMKernel, __FILE__ ); +using LaplaceFEMKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( laplaceFEMKernelJIT, geosx::LaplaceFEMKernel ), arrayView1d< globalIndex const > const &, globalIndex, CRSMatrixView< real64, globalIndex const > const &, arrayView1d< real64 > const &, string const & >; -using LaplaceSparsityDispatch = finiteElement::SparsityKernelDispatch< JITTI_TPARAM( geosx::LaplaceFEMKernel ) >; +using LaplaceSparsityDispatch = finiteElement::SparsityKernelDispatch< JITTI_TPARAM( laplaceFEMKernelJIT, geosx::LaplaceFEMKernel ) >; } // namespace geosx diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp index 97e34391f13..ab8ffd2d2a2 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEMKernels.hpp @@ -287,8 +287,8 @@ class PhaseFieldDamageKernel : }; -JITTI_NAME( geosx::PhaseFieldDamageKernel ); -using PhaseFieldDamageKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::PhaseFieldDamageKernel ), +JITTI_DECL( phaseFieldDamageKernelJIT, geosx::PhaseFieldDamageKernel, __FILE__ ); +using PhaseFieldDamageKernelDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( phaseFieldDamageKernelJIT, geosx::PhaseFieldDamageKernel ), arrayView1d< globalIndex const > const &, globalIndex, CRSMatrixView< real64, globalIndex const > const &, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp index 61a2e13d1cc..9d63018da23 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsEFEMKernels.hpp @@ -475,8 +475,8 @@ class QuasiStatic : }; /// The factory used to construct a QuasiStatic kernel. -JITTI_NAME( geosx::SolidMechanicsEFEMKernels::QuasiStatic ) -using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::SolidMechanicsEFEMKernels::QuasiStatic ), +JITTI_DECL( quasiStaticJIT, geosx::SolidMechanicsEFEMKernels::QuasiStatic, __FILE__ ) +using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( quasiStaticJIT, geosx::SolidMechanicsEFEMKernels::QuasiStatic ), EmbeddedSurfaceSubRegion const &, arrayView1d< globalIndex const > const &, arrayView1d< globalIndex const > const &, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp index e306c4628b9..31f08983549 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFiniteStrainExplicitNewmarkKernel.hpp @@ -200,7 +200,8 @@ class ExplicitFiniteStrain : public ExplicitSmallStrain< SUBREGION_TYPE, #undef UPDATE_STRESS /// The factory used to construct a ExplicitFiniteStrain kernel. -using ExplicitFiniteStrainDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( ExplicitFiniteStrain ), +JITTI_DECL( explicitFiniteStrain, geosx::SolidMechanicsLagrangianFEMKernels::ExplicitFiniteStrain, __FILE__ ); +using ExplicitFiniteStrainDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( explicitFiniteStrain, geosx::SolidMechanicsLagrangianFEMKernels::ExplicitFiniteStrain ), real64, string const & >; diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp index 9948f545a6d..b12bdd3dc74 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainExplicitNewmarkKernel.hpp @@ -340,7 +340,8 @@ class ExplicitSmallStrain : public finiteElement::KernelBase< SUBREGION_TYPE, #undef UPDATE_STRESS /// The factory used to construct a ExplicitSmallStrain kernel. -using ExplicitSmallStrainDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( ExplicitSmallStrain ), +JITTI_DECL( explicitSmallStrainJIT, geosx::SolidMechanicsLagrangianFEMKernels::ExplicitSmallStrain, __FILE__ ); +using ExplicitSmallStrainDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( explicitSmallStrainJIT, geosx::SolidMechanicsLagrangianFEMKernels::ExplicitSmallStrain ), real64, string const & >; diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp index c40c7cc0a4d..7425da3e8f5 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainImplicitNewmarkKernel.hpp @@ -292,7 +292,8 @@ class ImplicitNewmark : public QuasiStatic< SUBREGION_TYPE, }; /// The factory used to construct a ImplicitNewmark kernel. -using ImplicitNewmarkDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( ImplicitNewmark ), +JITTI_DECL( implcitNewmarkJIT, geosx::SolidMechanicsLagrangianFEMKernels::ImplicitNewmark, __FILE__ ); +using ImplicitNewmarkDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( implcitNewmarkJIT, geosx::SolidMechanicsLagrangianFEMKernels::ImplicitNewmark ), arrayView1d< globalIndex const > const &, globalIndex, CRSMatrixView< real64, globalIndex const > const &, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp index a8115448e37..97d2b5b9478 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsSmallStrainQuasiStaticKernel.hpp @@ -330,15 +330,15 @@ class QuasiStatic : }; /// The factory used to construct a QuasiStatic kernel. -JITTI_NAME( geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ); -using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ), +JITTI_DECL( quasiStaticJIT, geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic, __FILE__ ); +using QuasiStaticDispatch = finiteElement::KernelDispatch< JITTI_TPARAM( quasiStaticJIT, geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ), arrayView1d< globalIndex const > const &, globalIndex, CRSMatrixView< real64, globalIndex const > const &, arrayView1d< real64 > const &, real64 const (&)[3] >; -using QuasiStaticSparsityDispatch = finiteElement::SparsityKernelDispatch< JITTI_TPARAM( geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ) >; +using QuasiStaticSparsityDispatch = finiteElement::SparsityKernelDispatch< JITTI_TPARAM( quasiStaticJIT, geosx::SolidMechanicsLagrangianFEMKernels::QuasiStatic ) >; } // namespace SolidMechanicsLagrangianFEMKernels From 8016eeb94c9dc3fe4e6b64484f902513a7604483 Mon Sep 17 00:00:00 2001 From: wrtobin Date: Wed, 1 Sep 2021 12:19:44 -0700 Subject: [PATCH 05/10] resolve mpi issues, jitti-active build passing integration tests on quartz --- .../finiteElement/kernelInterface/KernelBase.hpp | 4 ++-- .../kernelInterface/SparsityKernelBase.hpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp index 876c9febf85..7bee4e554da 100644 --- a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp @@ -409,8 +409,8 @@ class KernelBase buildCache.getOrLoadOrCompile( info ); } MpiWrapper::barrier( ); - auto & jitKernelDispatch = buildCache.getOrLoadOrCompile( info ); - + buildCache.refresh( ); + auto & jitKernelDispatch = buildCache.getOrLoad( info ); return jitKernelDispatch( numElems, nodeManager, edgeManager, diff --git a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp index 3e88eb7eb85..b9e93c5c394 100644 --- a/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/SparsityKernelBase.hpp @@ -362,10 +362,22 @@ class SparsityKernelDispatchJIT arrayView1d< globalIndex const > const &, globalIndex const, SparsityPattern< globalIndex > & ); + string outputDir( STRINGIZE( JITTI_OUTPUT_DIR ) ); outputDir += "/"; static jitti::Cache< JIT_SPARSITY_DISPATCH > buildCache( time(NULL), outputDir ); - auto & jitSparsityDispatch = buildCache.getOrLoadOrCompile( info ); + if ( MpiWrapper::commRank( ) == 0 ) + { + buildCache.getOrLoadOrCompile( info ); + } + MpiWrapper::barrier( ); + // check if the library with the function is available + if ( buildCache.tryGet( info ) == nullptr ) + { + // if not, refresh by reading the filesystem to find the new library on the first iteration + buildCache.refresh( ); + } + auto & jitSparsityDispatch = buildCache.getOrLoad( info ); return jitSparsityDispatch( numElems, nodeManager, edgeManager, From 5860e9042ba793f69e574877c6e97697f871827c Mon Sep 17 00:00:00 2001 From: wrtobin Date: Wed, 1 Sep 2021 12:22:38 -0700 Subject: [PATCH 06/10] missed from last commit --- .../finiteElement/kernelInterface/KernelBase.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp index 7bee4e554da..d97dafb5954 100644 --- a/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp +++ b/src/coreComponents/finiteElement/kernelInterface/KernelBase.hpp @@ -409,7 +409,12 @@ class KernelBase buildCache.getOrLoadOrCompile( info ); } MpiWrapper::barrier( ); - buildCache.refresh( ); + // check if the library with the function is available + if ( buildCache.tryGet( info ) == nullptr ) + { + // if not, refresh by reading the filesystem to find the new library on the first iteration + buildCache.refresh( ); + } auto & jitKernelDispatch = buildCache.getOrLoad( info ); return jitKernelDispatch( numElems, nodeManager, From ea0ab5c5bb91f86d9d0820a469027fc246e89bd2 Mon Sep 17 00:00:00 2001 From: wrtobin Date: Wed, 1 Sep 2021 14:21:42 -0700 Subject: [PATCH 07/10] add full-jit cmake option --- host-configs/LLNL/quartz-base.cmake | 1 + src/cmake/GeosxOptions.cmake | 10 ++++++++++ src/coreComponents/finiteElement/CMakeLists.txt | 2 +- src/coreComponents/physicsSolvers/CMakeLists.txt | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/host-configs/LLNL/quartz-base.cmake b/host-configs/LLNL/quartz-base.cmake index 2554789edd6..25dc4b54bde 100644 --- a/host-configs/LLNL/quartz-base.cmake +++ b/host-configs/LLNL/quartz-base.cmake @@ -29,5 +29,6 @@ set(ENABLE_OPENMP ON CACHE BOOL "") set(ENABLE_PAMELA ON CACHE BOOL "") set(ENABLE_PVTPackage ON CACHE BOOL "") set(ENABLE_PETSC OFF CACHE BOOL "Enables PETSc." FORCE) +set(ENABLE_JITTI ON CACHE BOOL "Enables kernel JIT compilation." FORCE) include(${CMAKE_CURRENT_LIST_DIR}/../tpls.cmake) diff --git a/src/cmake/GeosxOptions.cmake b/src/cmake/GeosxOptions.cmake index 22ac9e77e68..b9089743067 100644 --- a/src/cmake/GeosxOptions.cmake +++ b/src/cmake/GeosxOptions.cmake @@ -93,6 +93,16 @@ endif(NOT BLT_CXX_STD STREQUAL c++14) message("CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") +option( ENABLE_JITTI "Build all compute kernels just-in-time at runtime." OFF ) + +if ( ENABLE_JITTI ) + message( "JITTI is ENABLED") + set( JITTI_DEFINES "JITTI=1" ) +else ( ) + set( JITTI_DEFINES "JITTI=0" ) + message( "JITTI is DISABLED") +endif ( ) + blt_append_custom_compiler_flag( FLAGS_VAR CMAKE_CXX_FLAGS DEFAULT "${OpenMP_CXX_FLAGS}") blt_append_custom_compiler_flag( FLAGS_VAR CMAKE_CXX_FLAGS GNU "-Wall -Wextra -Wpedantic -pedantic-errors -Wshadow -Wfloat-equal -Wcast-align -Wcast-qual" diff --git a/src/coreComponents/finiteElement/CMakeLists.txt b/src/coreComponents/finiteElement/CMakeLists.txt index 8182b1712fa..eec281bdf3d 100644 --- a/src/coreComponents/finiteElement/CMakeLists.txt +++ b/src/coreComponents/finiteElement/CMakeLists.txt @@ -39,7 +39,7 @@ endif() blt_add_library( NAME finiteElement SOURCES ${finiteElement_sources} HEADERS ${finiteElement_headers} - DEFINES JITTI_OUTPUT_DIR=${CMAKE_BINARY_DIR}/lib/jitti + DEFINES JITTI_OUTPUT_DIR=${CMAKE_BINARY_DIR}/lib/jitti ${JITTI_DEFINES} DEPENDS_ON ${dependencyList} jitti OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) diff --git a/src/coreComponents/physicsSolvers/CMakeLists.txt b/src/coreComponents/physicsSolvers/CMakeLists.txt index fe0e49b8eb8..55827a20a72 100644 --- a/src/coreComponents/physicsSolvers/CMakeLists.txt +++ b/src/coreComponents/physicsSolvers/CMakeLists.txt @@ -126,6 +126,7 @@ blt_add_library( NAME physicsSolvers SOURCES ${physicsSolvers_sources} HEADERS ${physicsSolvers_headers} DEPENDS_ON ${dependencyList} ${externalComponentDeps} + DEFINES ${JITTI_DEFINES} OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) From 16068c348c83bdb03db2a4e30c29e03745932a53 Mon Sep 17 00:00:00 2001 From: wrtobin Date: Wed, 1 Sep 2021 16:06:04 -0700 Subject: [PATCH 08/10] all regression tests passing, though multiple passes can be required due to file conflicts if multiple runs try to compile a kernel simultaneously --- .../multiphysics/MultiphasePoromechanicsKernel.hpp | 1 + .../multiphysics/SinglePhasePoromechanicsKernel.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp index 03b1c7b199e..59d3820ade3 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsKernel.hpp @@ -20,6 +20,7 @@ #define GEOSX_PHYSICSSOLVERS_MULTIPHYSICS_MULTIPHASEPOROMECHANICSKERNEL_HPP_ #include "finiteElement/kernelInterface/ImplicitKernelBase.hpp" #include "physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp" +#include "constitutive/fluid/MultiFluidBase.hpp" namespace geosx { diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp index a326629d184..ed0303e68f0 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsKernel.hpp @@ -20,6 +20,7 @@ #define GEOSX_PHYSICSSOLVERS_MULTIPHYSICS_SINGLEPHASEPOROMECHANICSKERNEL_HPP_ #include "finiteElement/kernelInterface/ImplicitKernelBase.hpp" #include "physicsSolvers/fluidFlow/SinglePhaseBase.hpp" +#include "constitutive/fluid/SingleFluidBase.hpp" namespace geosx From 9bc353d94c6b146a883d9f99dc80ae627ef14464 Mon Sep 17 00:00:00 2001 From: wrtobin Date: Wed, 1 Sep 2021 16:07:26 -0700 Subject: [PATCH 09/10] submodule update I'll have to revert before the merge can go in --- src/coreComponents/LvArray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/LvArray b/src/coreComponents/LvArray index ab0d3025d29..48e8365b078 160000 --- a/src/coreComponents/LvArray +++ b/src/coreComponents/LvArray @@ -1 +1 @@ -Subproject commit ab0d3025d2962aad10457b7bf7f5b6d266232276 +Subproject commit 48e8365b0785eb436ac82bd8212dcae3577184d0 From d610d60c85707f833cc099490ddee869b567dcc1 Mon Sep 17 00:00:00 2001 From: wrtobin Date: Thu, 7 Oct 2021 08:46:57 -0700 Subject: [PATCH 10/10] missing file --- .../kernelInterface/kernelJIT.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/coreComponents/finiteElement/kernelInterface/kernelJIT.cpp diff --git a/src/coreComponents/finiteElement/kernelInterface/kernelJIT.cpp b/src/coreComponents/finiteElement/kernelInterface/kernelJIT.cpp new file mode 100644 index 00000000000..aa6b3b473a3 --- /dev/null +++ b/src/coreComponents/finiteElement/kernelInterface/kernelJIT.cpp @@ -0,0 +1,40 @@ +#include "KernelBase.hpp" +#include "kernelJITCompileCommands.hpp" // generated by cmake / jit python script / contains needed macros + +namespace geosx +{ + namespace finiteElement + { + +#if defined( GEOSX_USE_CUDA ) + constexpr bool compilerIsNVCC = true; +#else + constexpr bool compilerIsNVCC = false; +#endif + + jitti::CompilationInfo getKernelCompilationInfo( const string & header ) + { + jitti::CompilationInfo info; + info.compileCommand = kernelJIT_COMPILE_COMMAND; + info.compilerIsNVCC = compilerIsNVCC; + info.linker = kernelJIT_LINKER; + info.linkArgs = kernelJIT_LINK_ARGS; + info.headerFile = header; + info.templateFunction = "geosx::finiteElement::buildKernelAndInvoke"; + return info; + } + + jitti::CompilationInfo getSparsityCompilationInfo( const string & header ) + { + jitti::CompilationInfo info; + info.compileCommand = kernelJIT_COMPILE_COMMAND; + info.compilerIsNVCC = compilerIsNVCC; + info.linker = kernelJIT_LINKER; + info.linkArgs = kernelJIT_LINK_ARGS; + info.headerFile = header; + info.templateFunction = "geosx::finiteElement::buildSparsityAndInvoke"; + return info; + } + } +} +