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

The CUDA version of the Merson solver is implemented.

parent d6945662
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ check_PROGRAMS = tnl-unit-tests \
                  
tnl_unit_tests_SOURCES = $(tnl_unit_tests_sources)
tnl_unit_tests_LDADD = libtnl-0.1.la \
                       core/libcore-tests.la
                       core/libcore-tests.la \
                       diff/libdiff-tests.la

tnl_benchmarks_SOURCES = $(tnl_benchmarks_sources) $(tnl_benchmarks_headers)
tnl_benchmarks_LDADD = libtnl-0.1.la
@@ -65,7 +66,8 @@ if BUILD_DBG
bin_PROGRAMS = tnl-unit-tests-dbg
tnl_unit_tests_dbg_SOURCES = $(tnl_unit_tests_sources)
tnl_unit_tests_dbg_LDADD = libtnl-dbg-0.1.la \
                           core/libcore-tests-dbg.la
                           core/libcore-tests-dbg.la \
                           diff/libdiff-tests-dbg.la
endif


+5 −0
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@ template< class T > class tnlFieldCUDA2D : public tnlLongVectorCUDA< T >
     x_size( f. x_size ), y_size( f. y_size )
   { };

   tnlFieldCUDA2D( const tnlField2D< T >& f )
      : tnlLongVectorCUDA< T >( f ),
        x_size( f. GetXSize() ), y_size( f. GetYSize() )
      { };

   tnlString GetType() const
   {
      T t;
+20 −0
Original line number Diff line number Diff line
@@ -76,6 +76,26 @@ template< class T > class tnlLongVectorCUDA : public tnlObject
   }
#endif

   //! Constructor with another long vector as template
   tnlLongVectorCUDA( const tnlLongVector< T >& v )
#ifdef HAVE_CUDA
    : tnlObject( v ), size( v. GetSize() ), shared_data( false )
   {

      if( cudaMalloc( ( void** ) &data, ( size + 1 ) * sizeof( T ) ) != cudaSuccess )
      {
         cerr << "Unable to allocate new long vector with size " << size << " on CUDA device." << endl;
         data = NULL;
         abort();
      }
      //data ++;
   };
#else
   {
      cerr << "CUDA support is missing in this system." << endl;
   }
#endif


   tnlString GetType() const
   {
+16 −0
Original line number Diff line number Diff line
@@ -59,8 +59,24 @@ endif


if BUILD_MPI_DBG

   noinst_LTLIBRARIES += libtnldiff-mpi-dbg-0.1.la 
   libtnldiff_mpi_dbg_0_1_la_CXXFLAGS = $(MPICXXFLAGS) $(DBGCXXFLAGS)
   libtnldiff_mpi_dbg_0_1_la_LDFLAGS = $(LDFLAGS) $(MPILDFLAGS) $(DBGLDFLAGS)
   libtnldiff_mpi_dbg_0_1_la_SOURCES = $(sources) $(headers)
endif

libdiff_tests_sources = 

if BUILD_CUDA
libdiff_tests_sources += tnlMersonSolverCUDATester.h \
                         tnlMersonSolverCUDATester.cu
endif                        

check_LTLIBRARIES = libdiff-tests.la
libdiff_tests_la_SOURCES = $(libdiff_tests_sources)

if BUILD_DBG
noinst_LTLIBRARIES += libdiff-tests-dbg.la
libdiff_tests_dbg_la_SOURCES = $(libdiff_tests_sources)
endif 
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ template< class T > T GetDiffMaxNorm( const tnlGrid2D< T >& u1,
   for( i = 0; i < size; i ++ )
   {
      T diff = _u1[ i ] - _u2[ i ];
      result = Max( result, fabs( diff ) );
      result = Max( result, ( T ) fabs( diff ) );
   }
   return result;
};
Loading