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

Adding timer for transfering the metadata on GPU.

parent 67168e9b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <operators/diffusion/tnlLinearDiffusion.h>
#include <matrices/tnlEllpackMatrix.h>
#include <functions/tnlMeshFunction.h>
#include <core/tnlTimer.h>

template< typename Mesh,
          typename BoundaryCondition,
@@ -60,6 +61,9 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
      void writeProlog( tnlLogger& logger,
                        const tnlParameterContainer& parameters ) const;
      
      bool writeEpilog( tnlLogger& logger );


      bool setup( const tnlParameterContainer& parameters );

      bool setInitialCondition( const tnlParameterContainer& parameters,
@@ -108,6 +112,8 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
         BoundaryCondition boundaryCondition;

         RightHandSide rightHandSide;
         
         tnlTimer gpuTransferTimer;
};

#include <problems/tnlHeatEquationProblem_impl.h>
+15 −0
Original line number Diff line number Diff line
@@ -68,6 +68,19 @@ writeProlog( tnlLogger& logger, const tnlParameterContainer& parameters ) const
{
}

template< typename Mesh,
          typename BoundaryCondition,
          typename RightHandSide,
          typename DifferentialOperator >
bool
tnlHeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
writeEpilog( tnlLogger& logger )
{
   logger.writeParameter< const char* >( "GPU transfer time:", "" );
   this->gpuTransferTimer.writeLog( logger, 1 );
   return true;
}

template< typename Mesh,
          typename BoundaryCondition,
          typename RightHandSide,
@@ -76,6 +89,7 @@ bool
tnlHeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
setup( const tnlParameterContainer& parameters )
{
   this->gpuTransferTimer.reset();
   if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) ||
       ! this->rightHandSide.setup( parameters, "right-hand-side-" ) )
      return false;
@@ -207,6 +221,7 @@ getExplicitRHS( const RealType& time,
   this->bindDofs( mesh, uDofs );
   MeshFunctionType fu( mesh, fuDofs );
   tnlExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
   explicitUpdater.setGPUTransferTimer( this->gpuTransferTimer ); 
   explicitUpdater.template update< typename Mesh::Cell >( 
      time,
      mesh,
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ class tnlPDEProblem : public tnlProblem< Real, Device, Index >
      void writeProlog( tnlLogger& logger,
                        const tnlParameterContainer& parameters ) const;
      
      bool writeEpilog( tnlLogger& logger ) const;


      bool setMeshDependentData( const MeshType& mesh,
                                 MeshDependentDataType& meshDependentData );

+12 −0
Original line number Diff line number Diff line
@@ -54,6 +54,18 @@ writeProlog( tnlLogger& logger, const tnlParameterContainer& parameters ) const
{
}

template< typename Mesh,
          typename Real,
          typename Device,
          typename Index >
bool
tnlPDEProblem< Mesh, Real, Device, Index >::
writeEpilog( tnlLogger& logger ) const
{
   return true;
}


template< typename Mesh,
          typename Real,
          typename Device,
+13 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define TNLEXPLICITUPDATER_H_

#include <functions/tnlFunctionAdapter.h>
#include <core/tnlTimer.h>

template< typename Real,
          typename MeshFunction,
@@ -73,6 +74,14 @@ class tnlExplicitUpdater
                                                   BoundaryConditions,
                                                   RightHandSide > TraverserUserData;
      
      tnlExplicitUpdater()
      : gpuTransferTimer( 0 ){}
      
      void setGPUTransferTimer( tnlTimer& timer )
      {
         this->gpuTransferTimer = &timer;
      }

      template< typename EntityType >
      void update( const RealType& time,
                   const MeshType& mesh,
@@ -126,6 +135,10 @@ class tnlExplicitUpdater
                     *userData.time );
            }
      };
      
   protected:
      
      tnlTimer* gpuTransferTimer;
};

#include <solvers/pde/tnlExplicitUpdater_impl.h>
Loading