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

Merge branch 'mpi' of geraldine.fjfi.cvut.cz:/local/projects/tnl/tnl into mpi

parents 888f8de4 0eff2f63
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -168,6 +168,24 @@ T sign( const T& a )
   return ( T ) 1;
}

template< class T >
__cuda_callable__
bool isNan( const T& v )
{
#if defined HAVE_CUDA
   #if defined(__CUDA_ARCH__)
      return isnan( v );
   #else
      #if defined (__GNUC__) && ( __GNUC__  < 5 )
         return false;
      #else
         return std::isnan( v );
      #endif
   #endif
#else
   return std::isnan( v );
#endif
}
template< typename Real >
__cuda_callable__
bool isSmall( const Real& v,
+5 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@

#include <cstring>   // std::memcpy, std::memcmp
#include <cstddef>   // std::nullptr_t
#include <algorithm> // swap

//#define TNL_DEBUG_SHARED_POINTERS

@@ -67,7 +68,7 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer

      using ObjectType = Object;
      using DeviceType = Devices::Cuda; 
      using ThisType = SharedPointer<  Object, Devices::Host >;
      using ThisType = SharedPointer<  Object, Devices::Cuda >;

      SharedPointer( std::nullptr_t )
      : pd( nullptr )
@@ -321,7 +322,7 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer

      using ObjectType = Object;
      using DeviceType = Devices::Cuda; 
      using ThisType = SharedPointer<  Object, Devices::Host >;
      using ThisType = SharedPointer<  Object, Devices::Cuda >;

      SharedPointer( std::nullptr_t )
      : pd( nullptr ),
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <TNL/Pointers/SmartPointer.h>

#include <cstddef>   // std::nullptr_t
#include <algorithm> // swap

namespace TNL {
namespace Pointers {
+4 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@

#include <cstring>   // std::memcpy, std::memcmp
#include <cstddef>   // std::nullptr_t
#include <algorithm> // swap

namespace TNL {
namespace Pointers {
@@ -44,7 +45,7 @@ class SharedPointer< Object, Devices::MIC > : public SmartPointer

      using ObjectType = Object;
      using DeviceType = Devices::MIC; 
      using ThisType = SharedPointer<  Object, Devices::Host >;
      using ThisType = SharedPointer<  Object, Devices::MIC >;

      SharedPointer( std::nullptr_t )
      : pd( nullptr ),
+2 −2
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ bool IterativeSolver< Real, Index> :: checkNextIteration()
{
   this->refreshSolverMonitor();

   if( std::isnan( this->getResidue() ) ||
   if( isNan( this->getResidue() ) ||
       this->getIterations() > this->getMaxIterations()  ||
       ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() >= this->getMinIterations() ) ||
       ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() >= this->getMinIterations() ) )
@@ -120,7 +120,7 @@ bool
IterativeSolver< Real, Index>::
checkConvergence()
{
   if( std::isnan( this->getResidue() ) )
   if( isNan( this->getResidue() ) )
   {
      std::cerr << std::endl << "The residue is NaN." << std::endl;
      return false;
Loading