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

Fixes of tridiagonal matrix examples for CUDA.

parent e3e89082
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -44,9 +44,6 @@ int main( int argc, char* argv[] )
   setElements< TNL::Devices::Host >();

#ifdef HAVE_CUDA
   // It seems that nvcc 10.1 does not handle lambda functions properly. 
   // It is hard to make nvcc to compile this example and it does not work
   // properly. We will try it with later version of CUDA.
   std::cout << "Set elements on CUDA device:" << std::endl;
   setElements< TNL::Devices::Cuda >();
#endif
+0 −7
Original line number Diff line number Diff line
@@ -16,10 +16,6 @@ void getRowExample()
   auto view = matrix.getView();

   auto f = [=] __cuda_callable__ ( int rowIdx ) mutable {
      //auto row = matrix->getRow( rowIdx );    
      // For some reason the previous line of code is not accepted by nvcc 10.1 
      // so we replace it with the following two lines.
      //auto ref = matrix.modifyData();
      auto row = view.getRow( rowIdx );

      if( rowIdx > 0 )
@@ -42,9 +38,6 @@ int main( int argc, char* argv[] )
   getRowExample< TNL::Devices::Host >();

#ifdef HAVE_CUDA
   // It seems that nvcc 10.1 does not handle lambda functions properly. 
   // It is hard to make nvcc to compile this example and it does not work
   // properly. We will try it with later version of CUDA.
   std::cout << "Getting matrix rows on CUDA device: " << std::endl;
   getRowExample< TNL::Devices::Cuda >();
#endif
+0 −3
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@ int main( int argc, char* argv[] )
   setElements< TNL::Devices::Host >();

#ifdef HAVE_CUDA
   // It seems that nvcc 10.1 does not handle lambda functions properly. 
   // It is hard to make nvcc to compile this example and it does not work
   // properly. We will try it with later version of CUDA.
   std::cout << "Set elements on CUDA device:" << std::endl;
   setElements< TNL::Devices::Cuda >();
#endif
+2 −2
Original line number Diff line number Diff line
@@ -600,7 +600,7 @@ operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealA
      if( std::is_same< Device, Device_ >::value )
      {
         const auto matrix_view = matrix.getView();
         auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
         auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable {
            value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
         };
         this->forAllRows( f );
@@ -610,7 +610,7 @@ operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealA
         TridiagonalMatrix< Real, Device, Index, Organization_ > auxMatrix;
         auxMatrix = matrix;
         const auto matrix_view = auxMatrix.getView();
         auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
         auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable {
            value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
         };
         this->forAllRows( f );
+3 −0
Original line number Diff line number Diff line
@@ -275,6 +275,7 @@ class TridiagonalMatrixView : public MatrixView< Real, Device, Index >
       * \par Output
       * \include TridiagonalMatrixViewExample_setElement.out
       */
      __cuda_callable__
      void setElement( const IndexType row,
                       const IndexType column,
                       const RealType& value );
@@ -302,6 +303,7 @@ class TridiagonalMatrixView : public MatrixView< Real, Device, Index >
       * \include TridiagonalMatrixViewExample_addElement.out
       * 
       */
      __cuda_callable__
      void addElement( const IndexType row,
                       const IndexType column,
                       const RealType& value,
@@ -328,6 +330,7 @@ class TridiagonalMatrixView : public MatrixView< Real, Device, Index >
       * \include TridiagonalMatrixViewExample_getElement.out
       * 
       */
      __cuda_callable__
      RealType getElement( const IndexType row,
                           const IndexType column ) const;

Loading