Commit 71a1f300 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Fixing multidiagonal matrix with CUDA.

parent 6747a546
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -76,14 +76,16 @@ public:
   __cuda_callable__
   IndexType getColumns() const;

   virtual void setElement( const IndexType row,
   //virtual TODO: uncomment
   void setElement( const IndexType row,
                            const IndexType column,
                            const RealType& value ) = 0;
                            const RealType& value );// = 0;

   virtual void addElement( const IndexType row,
   //virtual TODO: uncomment
   void addElement( const IndexType row,
                            const IndexType column,
                            const RealType& value,
                            const RealType& thisElementMultiplicator = 1.0 ) = 0;
                            const RealType& thisElementMultiplicator = 1.0 );// = 0;

   virtual Real getElement( const IndexType row,
                            const IndexType column ) const = 0;
+1 −1
Original line number Diff line number Diff line
@@ -707,7 +707,7 @@ operator=( const Multidiagonal< Real_, Device_, Index_, RowMajorOrder_, RealAllo

            ////
            // Copy matrix elements from the buffer to the matrix
            auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value  ) mutable {
            auto f2 = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType localIdx, const IndexType columnIndex, RealType& value  ) mutable {
               const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
                  value = thisValuesBuffer_view[ bufferIdx ];
            };
+4 −4
Original line number Diff line number Diff line
@@ -30,10 +30,10 @@ class MultidiagonalMatrixView : public MatrixView< Real, Device, Index >
      using DeviceType = Device;
      using IndexType = Index;
      using BaseType = MatrixView< Real, Device, Index >;
      using DiagonalsShiftsType = Containers::Vector< IndexType, DeviceType, IndexType >;
      using DiagonalsShiftsView = typename DiagonalsShiftsType::ViewType;
      using HostDiagonalsShiftsType = Containers::Vector< IndexType, Devices::Host, IndexType >;
      using HostDiagonalsShiftsView = typename DiagonalsShiftsType::ViewType;
      //using DiagonalsShiftsType = Containers::Vector< IndexType, DeviceType, IndexType >;
      using DiagonalsShiftsView = Containers::VectorView< IndexType, DeviceType, IndexType >;
      //using HostDiagonalsShiftsType = Containers::Vector< IndexType, Devices::Host, IndexType >;
      using HostDiagonalsShiftsView = Containers::VectorView< IndexType, Devices::Host, IndexType >;
      using IndexerType = details::MultidiagonalMatrixIndexer< IndexType, RowMajorOrder >;
      using ValuesViewType = typename BaseType::ValuesView;
      using ViewType = MultidiagonalMatrixView< Real, Device, Index, RowMajorOrder >;
+1 −1
Original line number Diff line number Diff line
@@ -398,7 +398,7 @@ forRows( IndexType first, IndexType last, Function& function ) const
      {
         const IndexType columnIdx = rowIdx + diagonalsShifts_view[ localIdx ];
         if( columnIdx >= 0 && columnIdx < columns )
            function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx, 0 ) ] );
            function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ] );
      }
   };
   Algorithms::ParallelFor< DeviceType >::exec( first, last, f );