Loading examples/heat-equation/tnl-heat-equation.h +0 −3 Original line number Diff line number Diff line Loading @@ -64,14 +64,11 @@ class heatEquationSetter typedef Device DeviceType; typedef Index IndexType; typedef Containers::StaticVector< MeshType::meshDimensions, Real > Vertex; static bool run( const Config::ParameterContainer& parameters ) { enum { Dimensions = MeshType::meshDimensions }; typedef Operators::LinearDiffusion< MeshType, Real, Index > ApproximateOperator; typedef Functions::Analytic::Constant< Dimensions, Real > RightHandSide; typedef Containers::StaticVector < MeshType::meshDimensions, Real > Vertex; String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) Loading examples/heat-equation/tnl-run-heat-equation-eoc-test +82 −70 Original line number Diff line number Diff line #!/bin/bash device="host" threadsNumbers="1 2 4 6" dimensions="1D 2D 3D" #dimensions="1D" sizes1D="16 32 64 128 256 512" Loading Loading @@ -84,6 +85,7 @@ solve() { timeDiscretisation=$1 discreteSolver=$2 threadsNumber=$3 ${solverName} --device ${device} \ --mesh mesh.tnl \ --initial-condition exact-u-00000.tnl \ Loading Loading @@ -113,7 +115,10 @@ solve() --sigma ${sigma} \ --time-dependence ${timeDependence} \ --snapshot-period ${snapshotPeriod} \ --final-time ${finalTime} --final-time ${finalTime} \ --refresh-rate 50 \ --openmp-enabled true \ --openmp-max-threads ${threadsNumber} } computeError() Loading @@ -128,6 +133,11 @@ computeError() runTest() { for threadsNumber in ${threadsNumbers}; do mkdir -p threads-${threadsNumber} cd threads-${threadsNumber} for testFunction in ${testFunctions}; do mkdir -p ${testFunction} Loading Loading @@ -173,8 +183,8 @@ runTest() echo "=========================================================================" echo "=== STARTING THE SOLVER ===" echo "=========================================================================" #solve explicit merson solve semi-implicit gmres #solve explicit merson ${threadsNumber} solve semi-implicit gmres ${threadsNumber} mv computation-in-progress computation-done fi echo "=========================================================================" Loading @@ -199,6 +209,8 @@ runTest() done cd .. done cd .. done } runTest Loading src/TNL/Assert.h +5 −3 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ #ifndef NDEBUG #ifdef HAVE_CUDA // __CUDA_ARCH__ is defined by the compiler only for code executed on GPU #ifdef __CUDA_ARCH__ #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command ) \ if( ! ( ___tnl__assert_condition ) ) \ { \ Loading @@ -35,7 +36,7 @@ \ } #else // HAVE_CUDA #else // __CUDA_ARCH__ #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command ) \ if( ! ( ___tnl__assert_condition ) ) \ { \ Loading @@ -47,7 +48,8 @@ /*___tnl__assert_command;*/ \ throw EXIT_FAILURE; \ } #endif /* HAVE_CUDA */ #endif // __CUDA_ARCH__ #else /* #ifndef NDEBUG */ #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command ) #endif /* #ifndef NDEBUG */ No newline at end of file src/TNL/Containers/Algorithms/reduction-operations.h +12 −12 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ class tnlParallelReductionMin const RealType* data1, const RealType* data2 ) { return min( current, data1[ idx ] ); return TNL::min( current, data1[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -117,7 +117,7 @@ class tnlParallelReductionMax const RealType* data1, const RealType* data2 ) { return max( current, data1[ idx ] ); return TNL::max( current, data1[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return MinValue< ResultType>(); }; Loading Loading @@ -241,7 +241,7 @@ class tnlParallelReductionAbsSum : public tnlParallelReductionSum< Real, Index > const RealType* data1, const RealType* data2 ) { return current + ::abs( data1[ idx ] ); return current + TNL::abs( data1[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -270,7 +270,7 @@ class tnlParallelReductionAbsMin : public tnlParallelReductionMin< Real, Index > const RealType* data1, const RealType* data2 ) { return min( current, abs( data1[ idx ] ) ); return TNL::min( current, TNL::abs( data1[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -299,7 +299,7 @@ class tnlParallelReductionAbsMax : public tnlParallelReductionMax< Real, Index > const RealType* data1, const RealType* data2 ) { return std::max( current, ::abs( data1[ idx ] ) ); return std::max( current, TNL::abs( data1[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -365,7 +365,7 @@ class tnlParallelReductionLpNorm : public tnlParallelReductionSum< Real, Index > const RealType* data1, const RealType* data2 ) { return current + ::pow( ::abs( data1[ idx ] ), p ); return current + TNL::pow( TNL::abs( data1[ idx ] ), p ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -514,7 +514,7 @@ class tnlParallelReductionDiffMin : public tnlParallelReductionMin< Real, Index const RealType* data1, const RealType* data2 ) { return min( current, data1[ idx ] - data2[ idx ] ); return TNL::min( current, data1[ idx ] - data2[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -543,7 +543,7 @@ class tnlParallelReductionDiffMax : public tnlParallelReductionMax< Real, Index const RealType* data1, const RealType* data2 ) { return max( current, data1[ idx ] - data2[ idx ] ); return TNL::max( current, data1[ idx ] - data2[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -572,7 +572,7 @@ class tnlParallelReductionDiffAbsSum : public tnlParallelReductionMax< Real, Ind const RealType* data1, const RealType* data2 ) { return current + abs( data1[ idx ] - data2[ idx ] ); return current + TNL::abs( data1[ idx ] - data2[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -601,7 +601,7 @@ class tnlParallelReductionDiffAbsMin : public tnlParallelReductionMin< Real, Ind const RealType* data1, const RealType* data2 ) { return min( current, abs( data1[ idx ] - data2[ idx ] ) ); return TNL::min( current, TNL::abs( data1[ idx ] - data2[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -630,7 +630,7 @@ class tnlParallelReductionDiffAbsMax : public tnlParallelReductionMax< Real, Ind const RealType* data1, const RealType* data2 ) { return max( current, abs( data1[ idx ] - data2[ idx ] ) ); return TNL::max( current, TNL::abs( data1[ idx ] - data2[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -699,7 +699,7 @@ class tnlParallelReductionDiffLpNorm : public tnlParallelReductionSum< Real, Ind const RealType* data1, const RealType* data2 ) { return current + ::pow( abs( data1[ idx ] - data2[ idx ] ), p ); return current + TNL::pow( TNL::abs( data1[ idx ] - data2[ idx ] ), p ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading src/TNL/Containers/Array_impl.h +19 −15 Original line number Diff line number Diff line Loading @@ -175,7 +175,7 @@ setSize( const Index size ) Algorithms::ArrayOperations< Device >::allocateMemory( this->allocationPointer, size ); this->data = this->allocationPointer; this->size = size; if( ! this->allocationPointer ) if( size > 0 && ! this->allocationPointer ) { std::cerr << "I am not able to allocate new array with size " << ( double ) this->size * sizeof( ElementType ) / 1.0e9 << " GB." << std::endl; Loading Loading @@ -370,6 +370,7 @@ operator = ( const Array< Element, Device, Index >& array ) TNL_ASSERT( array. getSize() == this->getSize(), std::cerr << "Source size: " << array. getSize() << std::endl << "Target size: " << this->getSize() << std::endl ); if( this->getSize() > 0 ) Algorithms::ArrayOperations< Device >:: template copyMemory< Element, Element, Loading @@ -391,6 +392,7 @@ operator = ( const ArrayT& array ) TNL_ASSERT( array. getSize() == this->getSize(), std::cerr << "Source size: " << array. getSize() << std::endl << "Target size: " << this->getSize() << std::endl ); if( this->getSize() > 0 ) Algorithms::ArrayOperations< Device, typename ArrayT::DeviceType >:: template copyMemory< Element, typename ArrayT::ElementType, Loading @@ -411,6 +413,8 @@ operator == ( const ArrayT& array ) const { if( array. getSize() != this->getSize() ) return false; if( this->getSize() == 0 ) return true; return Algorithms::ArrayOperations< Device, typename ArrayT::DeviceType >:: template compareMemory< typename ArrayT::ElementType, Element, Loading Loading
examples/heat-equation/tnl-heat-equation.h +0 −3 Original line number Diff line number Diff line Loading @@ -64,14 +64,11 @@ class heatEquationSetter typedef Device DeviceType; typedef Index IndexType; typedef Containers::StaticVector< MeshType::meshDimensions, Real > Vertex; static bool run( const Config::ParameterContainer& parameters ) { enum { Dimensions = MeshType::meshDimensions }; typedef Operators::LinearDiffusion< MeshType, Real, Index > ApproximateOperator; typedef Functions::Analytic::Constant< Dimensions, Real > RightHandSide; typedef Containers::StaticVector < MeshType::meshDimensions, Real > Vertex; String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) Loading
examples/heat-equation/tnl-run-heat-equation-eoc-test +82 −70 Original line number Diff line number Diff line #!/bin/bash device="host" threadsNumbers="1 2 4 6" dimensions="1D 2D 3D" #dimensions="1D" sizes1D="16 32 64 128 256 512" Loading Loading @@ -84,6 +85,7 @@ solve() { timeDiscretisation=$1 discreteSolver=$2 threadsNumber=$3 ${solverName} --device ${device} \ --mesh mesh.tnl \ --initial-condition exact-u-00000.tnl \ Loading Loading @@ -113,7 +115,10 @@ solve() --sigma ${sigma} \ --time-dependence ${timeDependence} \ --snapshot-period ${snapshotPeriod} \ --final-time ${finalTime} --final-time ${finalTime} \ --refresh-rate 50 \ --openmp-enabled true \ --openmp-max-threads ${threadsNumber} } computeError() Loading @@ -128,6 +133,11 @@ computeError() runTest() { for threadsNumber in ${threadsNumbers}; do mkdir -p threads-${threadsNumber} cd threads-${threadsNumber} for testFunction in ${testFunctions}; do mkdir -p ${testFunction} Loading Loading @@ -173,8 +183,8 @@ runTest() echo "=========================================================================" echo "=== STARTING THE SOLVER ===" echo "=========================================================================" #solve explicit merson solve semi-implicit gmres #solve explicit merson ${threadsNumber} solve semi-implicit gmres ${threadsNumber} mv computation-in-progress computation-done fi echo "=========================================================================" Loading @@ -199,6 +209,8 @@ runTest() done cd .. done cd .. done } runTest Loading
src/TNL/Assert.h +5 −3 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ #ifndef NDEBUG #ifdef HAVE_CUDA // __CUDA_ARCH__ is defined by the compiler only for code executed on GPU #ifdef __CUDA_ARCH__ #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command ) \ if( ! ( ___tnl__assert_condition ) ) \ { \ Loading @@ -35,7 +36,7 @@ \ } #else // HAVE_CUDA #else // __CUDA_ARCH__ #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command ) \ if( ! ( ___tnl__assert_condition ) ) \ { \ Loading @@ -47,7 +48,8 @@ /*___tnl__assert_command;*/ \ throw EXIT_FAILURE; \ } #endif /* HAVE_CUDA */ #endif // __CUDA_ARCH__ #else /* #ifndef NDEBUG */ #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command ) #endif /* #ifndef NDEBUG */ No newline at end of file
src/TNL/Containers/Algorithms/reduction-operations.h +12 −12 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ class tnlParallelReductionMin const RealType* data1, const RealType* data2 ) { return min( current, data1[ idx ] ); return TNL::min( current, data1[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -117,7 +117,7 @@ class tnlParallelReductionMax const RealType* data1, const RealType* data2 ) { return max( current, data1[ idx ] ); return TNL::max( current, data1[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return MinValue< ResultType>(); }; Loading Loading @@ -241,7 +241,7 @@ class tnlParallelReductionAbsSum : public tnlParallelReductionSum< Real, Index > const RealType* data1, const RealType* data2 ) { return current + ::abs( data1[ idx ] ); return current + TNL::abs( data1[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -270,7 +270,7 @@ class tnlParallelReductionAbsMin : public tnlParallelReductionMin< Real, Index > const RealType* data1, const RealType* data2 ) { return min( current, abs( data1[ idx ] ) ); return TNL::min( current, TNL::abs( data1[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -299,7 +299,7 @@ class tnlParallelReductionAbsMax : public tnlParallelReductionMax< Real, Index > const RealType* data1, const RealType* data2 ) { return std::max( current, ::abs( data1[ idx ] ) ); return std::max( current, TNL::abs( data1[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -365,7 +365,7 @@ class tnlParallelReductionLpNorm : public tnlParallelReductionSum< Real, Index > const RealType* data1, const RealType* data2 ) { return current + ::pow( ::abs( data1[ idx ] ), p ); return current + TNL::pow( TNL::abs( data1[ idx ] ), p ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -514,7 +514,7 @@ class tnlParallelReductionDiffMin : public tnlParallelReductionMin< Real, Index const RealType* data1, const RealType* data2 ) { return min( current, data1[ idx ] - data2[ idx ] ); return TNL::min( current, data1[ idx ] - data2[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -543,7 +543,7 @@ class tnlParallelReductionDiffMax : public tnlParallelReductionMax< Real, Index const RealType* data1, const RealType* data2 ) { return max( current, data1[ idx ] - data2[ idx ] ); return TNL::max( current, data1[ idx ] - data2[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -572,7 +572,7 @@ class tnlParallelReductionDiffAbsSum : public tnlParallelReductionMax< Real, Ind const RealType* data1, const RealType* data2 ) { return current + abs( data1[ idx ] - data2[ idx ] ); return current + TNL::abs( data1[ idx ] - data2[ idx ] ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -601,7 +601,7 @@ class tnlParallelReductionDiffAbsMin : public tnlParallelReductionMin< Real, Ind const RealType* data1, const RealType* data2 ) { return min( current, abs( data1[ idx ] - data2[ idx ] ) ); return TNL::min( current, TNL::abs( data1[ idx ] - data2[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return MaxValue< ResultType>(); }; Loading Loading @@ -630,7 +630,7 @@ class tnlParallelReductionDiffAbsMax : public tnlParallelReductionMax< Real, Ind const RealType* data1, const RealType* data2 ) { return max( current, abs( data1[ idx ] - data2[ idx ] ) ); return TNL::max( current, TNL::abs( data1[ idx ] - data2[ idx ] ) ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading Loading @@ -699,7 +699,7 @@ class tnlParallelReductionDiffLpNorm : public tnlParallelReductionSum< Real, Ind const RealType* data1, const RealType* data2 ) { return current + ::pow( abs( data1[ idx ] - data2[ idx ] ), p ); return current + TNL::pow( TNL::abs( data1[ idx ] - data2[ idx ] ), p ); }; __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; }; Loading
src/TNL/Containers/Array_impl.h +19 −15 Original line number Diff line number Diff line Loading @@ -175,7 +175,7 @@ setSize( const Index size ) Algorithms::ArrayOperations< Device >::allocateMemory( this->allocationPointer, size ); this->data = this->allocationPointer; this->size = size; if( ! this->allocationPointer ) if( size > 0 && ! this->allocationPointer ) { std::cerr << "I am not able to allocate new array with size " << ( double ) this->size * sizeof( ElementType ) / 1.0e9 << " GB." << std::endl; Loading Loading @@ -370,6 +370,7 @@ operator = ( const Array< Element, Device, Index >& array ) TNL_ASSERT( array. getSize() == this->getSize(), std::cerr << "Source size: " << array. getSize() << std::endl << "Target size: " << this->getSize() << std::endl ); if( this->getSize() > 0 ) Algorithms::ArrayOperations< Device >:: template copyMemory< Element, Element, Loading @@ -391,6 +392,7 @@ operator = ( const ArrayT& array ) TNL_ASSERT( array. getSize() == this->getSize(), std::cerr << "Source size: " << array. getSize() << std::endl << "Target size: " << this->getSize() << std::endl ); if( this->getSize() > 0 ) Algorithms::ArrayOperations< Device, typename ArrayT::DeviceType >:: template copyMemory< Element, typename ArrayT::ElementType, Loading @@ -411,6 +413,8 @@ operator == ( const ArrayT& array ) const { if( array. getSize() != this->getSize() ) return false; if( this->getSize() == 0 ) return true; return Algorithms::ArrayOperations< Device, typename ArrayT::DeviceType >:: template compareMemory< typename ArrayT::ElementType, Element, Loading