Loading src/TNL/Math.h +18 −0 Original line number Diff line number Diff line Loading @@ -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, Loading src/TNL/Pointers/SharedPointerCuda.h +5 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <cstring> // std::memcpy, std::memcmp #include <cstddef> // std::nullptr_t #include <algorithm> // swap //#define TNL_DEBUG_SHARED_POINTERS Loading Loading @@ -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 ) Loading Loading @@ -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 ), Loading src/TNL/Pointers/SharedPointerHost.h +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <TNL/Pointers/SmartPointer.h> #include <cstddef> // std::nullptr_t #include <algorithm> // swap namespace TNL { namespace Pointers { Loading src/TNL/Pointers/SharedPointerMic.h +4 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <cstring> // std::memcpy, std::memcmp #include <cstddef> // std::nullptr_t #include <algorithm> // swap namespace TNL { namespace Pointers { Loading @@ -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 ), Loading src/TNL/Solvers/IterativeSolver_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -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() ) ) Loading @@ -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 Loading
src/TNL/Math.h +18 −0 Original line number Diff line number Diff line Loading @@ -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, Loading
src/TNL/Pointers/SharedPointerCuda.h +5 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <cstring> // std::memcpy, std::memcmp #include <cstddef> // std::nullptr_t #include <algorithm> // swap //#define TNL_DEBUG_SHARED_POINTERS Loading Loading @@ -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 ) Loading Loading @@ -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 ), Loading
src/TNL/Pointers/SharedPointerHost.h +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <TNL/Pointers/SmartPointer.h> #include <cstddef> // std::nullptr_t #include <algorithm> // swap namespace TNL { namespace Pointers { Loading
src/TNL/Pointers/SharedPointerMic.h +4 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <cstring> // std::memcpy, std::memcmp #include <cstddef> // std::nullptr_t #include <algorithm> // swap namespace TNL { namespace Pointers { Loading @@ -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 ), Loading
src/TNL/Solvers/IterativeSolver_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -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() ) ) Loading @@ -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