Commit 33fc64cf authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Implementing heat-equation benchmark templated compact CUDA kernel.

parent f2b7e727
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -75,9 +75,9 @@ class tnlMeshFunction :
      
      const MeshType& getMesh() const;
      
      const VectorType& getData() const;      
      __cuda_callable__ const VectorType& getData() const;      
      
      VectorType& getData();
      __cuda_callable__ VectorType& getData();
      
      bool refresh( const RealType& time = 0.0 ) const;
      
+2 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ getMesh() const
template< typename Mesh,
          int MeshEntityDimensions,
          typename Real >
__cuda_callable__
const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType& 
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
getData() const
@@ -187,6 +188,7 @@ getData() const
template< typename Mesh,
          int MeshEntityDimensions,
          typename Real >
__cuda_callable__
typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType& 
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
getData()
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u )
      time += currentTau;

      if( ! this->nextIteration() )
         return false;
         return this->checkConvergence();

      /****
       * Compute the new time step.
+11 −6
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ operator()( const MeshFunction& u,
    * The following example is the Laplace operator approximated 
    * by the Finite difference method.
    */
    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
   /*static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
   static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
   const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 

@@ -151,9 +151,14 @@ operator()( const MeshFunction& u,
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse;
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); */

   /*const IndexType& xSize = entity.getMesh().getDimensions().x();
   const IndexType& c = entity.getIndex();
   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
   return ( u[ c - 1 ] - 2.0 * u[ c ] + u[ c + 1 ]  ) * hxSquareInverse +
          ( u[ c - xSize ] - 2.0 * u[ c ] + u[ c + xSize ] ) * hySquareInverse;*/
}

template< typename MeshReal,
+12 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ class HeatEquationBenchmarkProblem:
      using typename BaseType::DofVectorType;
      using typename BaseType::MeshDependentDataType;

      HeatEquationBenchmarkProblem();
      
      static tnlString getTypeStatic();

      tnlString getPrologHeader() const;
@@ -71,11 +73,21 @@ class HeatEquationBenchmarkProblem:
                                 DofVectorType& rightHandSide,
                                 MeshDependentDataType& meshDependentData );
      
      ~HeatEquationBenchmarkProblem();

   protected:

      DifferentialOperator differentialOperator;
      BoundaryCondition boundaryCondition;
      RightHandSide rightHandSide;
      
      tnlString cudaKernelType;
      
      MeshType* cudaMesh;
      BoundaryCondition* cudaBoundaryConditions;
      RightHandSide* cudaRightHandSide;
      DifferentialOperator* cudaDifferentialOperator;
      
};

#include "HeatEquationBenchmarkProblem_impl.h"
Loading