Commit 19591600 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added __cuda_callable__ marks to multimap accessors

parent f8b230e9
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -13,6 +13,8 @@
#include <type_traits>
#include <type_traits>
#include <ostream>
#include <ostream>


#include <TNL/Devices/Cuda.h>

namespace TNL {
namespace TNL {


template< typename Index,
template< typename Index,
@@ -31,33 +33,47 @@ class EllpackIndexMultimapValues
      using LocalIndexType = LocalIndex;
      using LocalIndexType = LocalIndex;
      using NetworkType    = EllpackIndexMultimap< IndexType, DeviceType, LocalIndexType >;
      using NetworkType    = EllpackIndexMultimap< IndexType, DeviceType, LocalIndexType >;


      __cuda_callable__
      EllpackIndexMultimapValues();
      EllpackIndexMultimapValues();


      __cuda_callable__
      EllpackIndexMultimapValues( EllpackIndexMultimapValues&& other );
      EllpackIndexMultimapValues( EllpackIndexMultimapValues&& other );


      __cuda_callable__
      EllpackIndexMultimapValues& operator=( const EllpackIndexMultimapValues& );
      EllpackIndexMultimapValues& operator=( const EllpackIndexMultimapValues& );


      __cuda_callable__
      EllpackIndexMultimapValues& operator=( EllpackIndexMultimapValues&& other );
      EllpackIndexMultimapValues& operator=( EllpackIndexMultimapValues&& other );


      __cuda_callable__
      void bind( const EllpackIndexMultimapValues& other );
      void bind( const EllpackIndexMultimapValues& other );


      __cuda_callable__
      bool setSize( const LocalIndexType& portsCount );
      bool setSize( const LocalIndexType& portsCount );


      __cuda_callable__
      LocalIndexType getSize() const;
      LocalIndexType getSize() const;


      __cuda_callable__
      LocalIndexType getAllocatedSize() const;
      LocalIndexType getAllocatedSize() const;


      __cuda_callable__
      void setValue( const LocalIndexType& portIndex,
      void setValue( const LocalIndexType& portIndex,
                     const IndexType& value );
                     const IndexType& value );


      __cuda_callable__
      IndexType getValue( const LocalIndexType& portIndex ) const;
      IndexType getValue( const LocalIndexType& portIndex ) const;


      __cuda_callable__
      IndexType& operator[]( const LocalIndexType& portIndex );
      IndexType& operator[]( const LocalIndexType& portIndex );


      __cuda_callable__
      const IndexType& operator[]( const LocalIndexType& portIndex ) const;
      const IndexType& operator[]( const LocalIndexType& portIndex ) const;


      __cuda_callable__
      bool operator==( const EllpackIndexMultimapValues& other ) const;
      bool operator==( const EllpackIndexMultimapValues& other ) const;


      __cuda_callable__
      bool operator!=( const EllpackIndexMultimapValues& other ) const;
      bool operator!=( const EllpackIndexMultimapValues& other ) const;


      void print( std::ostream& str ) const;
      void print( std::ostream& str ) const;
+14 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ namespace TNL {
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues()
EllpackIndexMultimapValues()
: values( nullptr ), valuesCount( nullptr ), allocatedSize( 0 )
: values( nullptr ), valuesCount( nullptr ), allocatedSize( 0 )
@@ -28,6 +29,7 @@ EllpackIndexMultimapValues()
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues( EllpackIndexMultimapValues&& other )
EllpackIndexMultimapValues( EllpackIndexMultimapValues&& other )
: values( other.values ), valuesCount( other.valuesCount ), allocatedSize( other.allocatedSize )
: values( other.values ), valuesCount( other.valuesCount ), allocatedSize( other.allocatedSize )
@@ -40,6 +42,7 @@ EllpackIndexMultimapValues( EllpackIndexMultimapValues&& other )
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
EllpackIndexMultimapValues< Index, Device, LocalIndex >&
EllpackIndexMultimapValues< Index, Device, LocalIndex >&
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator=( const EllpackIndexMultimapValues& other )
operator=( const EllpackIndexMultimapValues& other )
@@ -55,6 +58,7 @@ operator=( const EllpackIndexMultimapValues& other )
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
EllpackIndexMultimapValues< Index, Device, LocalIndex >&
EllpackIndexMultimapValues< Index, Device, LocalIndex >&
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator=( EllpackIndexMultimapValues&& other )
operator=( EllpackIndexMultimapValues&& other )
@@ -71,6 +75,7 @@ operator=( EllpackIndexMultimapValues&& other )
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
void
void
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
bind( const EllpackIndexMultimapValues& other )
bind( const EllpackIndexMultimapValues& other )
@@ -98,6 +103,7 @@ EllpackIndexMultimapValues( IndexType* values,
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
bool
bool
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
setSize( const LocalIndexType& size )
setSize( const LocalIndexType& size )
@@ -111,6 +117,7 @@ setSize( const LocalIndexType& size )
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
LocalIndex
LocalIndex
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
getSize() const
getSize() const
@@ -123,6 +130,7 @@ getSize() const
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
LocalIndex
LocalIndex
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
getAllocatedSize() const
getAllocatedSize() const
@@ -133,6 +141,7 @@ getAllocatedSize() const
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
void
void
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
setValue( const LocalIndexType& portIndex,
setValue( const LocalIndexType& portIndex,
@@ -148,6 +157,7 @@ setValue( const LocalIndexType& portIndex,
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
Index
Index
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
getValue( const LocalIndexType& portIndex ) const
getValue( const LocalIndexType& portIndex ) const
@@ -162,6 +172,7 @@ getValue( const LocalIndexType& portIndex ) const
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
Index&
Index&
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex )
operator[]( const LocalIndexType& portIndex )
@@ -176,6 +187,7 @@ operator[]( const LocalIndexType& portIndex )
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
const Index&
const Index&
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex ) const
operator[]( const LocalIndexType& portIndex ) const
@@ -190,6 +202,7 @@ operator[]( const LocalIndexType& portIndex ) const
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
bool
bool
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator==( const EllpackIndexMultimapValues& other ) const
operator==( const EllpackIndexMultimapValues& other ) const
@@ -205,6 +218,7 @@ operator==( const EllpackIndexMultimapValues& other ) const
template< typename Index,
template< typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
bool
bool
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator!=( const EllpackIndexMultimapValues& other ) const
operator!=( const EllpackIndexMultimapValues& other ) const
+13 −0
Original line number Original line Diff line number Diff line
@@ -13,6 +13,8 @@
#include <type_traits>
#include <type_traits>
#include <ostream>
#include <ostream>


#include <TNL/Devices/Cuda.h>

namespace TNL {
namespace TNL {


template< int ValuesCount,
template< int ValuesCount,
@@ -33,31 +35,42 @@ class StaticEllpackIndexMultimapValues
      using LocalIndexType = LocalIndex;
      using LocalIndexType = LocalIndex;
      using NetworkType    = StaticEllpackIndexMultimap< ValuesCount, IndexType, DeviceType, LocalIndexType >;
      using NetworkType    = StaticEllpackIndexMultimap< ValuesCount, IndexType, DeviceType, LocalIndexType >;


      __cuda_callable__
      StaticEllpackIndexMultimapValues();
      StaticEllpackIndexMultimapValues();


      __cuda_callable__
      StaticEllpackIndexMultimapValues( StaticEllpackIndexMultimapValues&& other );
      StaticEllpackIndexMultimapValues( StaticEllpackIndexMultimapValues&& other );


      __cuda_callable__
      StaticEllpackIndexMultimapValues& operator=( const StaticEllpackIndexMultimapValues& );
      StaticEllpackIndexMultimapValues& operator=( const StaticEllpackIndexMultimapValues& );


      __cuda_callable__
      StaticEllpackIndexMultimapValues& operator=( StaticEllpackIndexMultimapValues&& other );
      StaticEllpackIndexMultimapValues& operator=( StaticEllpackIndexMultimapValues&& other );


      __cuda_callable__
      void bind( const StaticEllpackIndexMultimapValues& other );
      void bind( const StaticEllpackIndexMultimapValues& other );


      constexpr LocalIndexType getSize() const;
      constexpr LocalIndexType getSize() const;


      constexpr LocalIndexType getAllocatedSize() const;
      constexpr LocalIndexType getAllocatedSize() const;


      __cuda_callable__
      void setValue( const LocalIndexType& portIndex,
      void setValue( const LocalIndexType& portIndex,
                     const IndexType& value );
                     const IndexType& value );


      __cuda_callable__
      IndexType getValue( const LocalIndexType& portIndex ) const;
      IndexType getValue( const LocalIndexType& portIndex ) const;


      __cuda_callable__
      IndexType& operator[]( const LocalIndexType& portIndex );
      IndexType& operator[]( const LocalIndexType& portIndex );


      __cuda_callable__
      const IndexType& operator[]( const LocalIndexType& portIndex ) const;
      const IndexType& operator[]( const LocalIndexType& portIndex ) const;


      __cuda_callable__
      bool operator==( const StaticEllpackIndexMultimapValues& other ) const;
      bool operator==( const StaticEllpackIndexMultimapValues& other ) const;


      __cuda_callable__
      bool operator!=( const StaticEllpackIndexMultimapValues& other ) const;
      bool operator!=( const StaticEllpackIndexMultimapValues& other ) const;


      void print( std::ostream& str ) const;
      void print( std::ostream& str ) const;
+11 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues()
StaticEllpackIndexMultimapValues()
: values( nullptr )
: values( nullptr )
@@ -30,6 +31,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues( StaticEllpackIndexMultimapValues&& other )
StaticEllpackIndexMultimapValues( StaticEllpackIndexMultimapValues&& other )
: values( other.values )
: values( other.values )
@@ -41,6 +43,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator=( const StaticEllpackIndexMultimapValues& other )
operator=( const StaticEllpackIndexMultimapValues& other )
@@ -56,6 +59,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator=( StaticEllpackIndexMultimapValues&& other )
operator=( StaticEllpackIndexMultimapValues&& other )
@@ -69,6 +73,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
void
void
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
bind( const StaticEllpackIndexMultimapValues& other )
bind( const StaticEllpackIndexMultimapValues& other )
@@ -113,6 +118,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
void
void
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
setValue( const LocalIndexType& portIndex,
setValue( const LocalIndexType& portIndex,
@@ -131,6 +137,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
Index
Index
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
getValue( const LocalIndexType& portIndex ) const
getValue( const LocalIndexType& portIndex ) const
@@ -148,6 +155,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
Index&
Index&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex )
operator[]( const LocalIndexType& portIndex )
@@ -165,6 +173,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
const Index&
const Index&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex ) const
operator[]( const LocalIndexType& portIndex ) const
@@ -182,6 +191,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
bool
bool
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator==( const StaticEllpackIndexMultimapValues& other ) const
operator==( const StaticEllpackIndexMultimapValues& other ) const
@@ -200,6 +210,7 @@ template< int ValuesCount,
          typename Index,
          typename Index,
          typename Device,
          typename Device,
          typename LocalIndex >
          typename LocalIndex >
__cuda_callable__
bool
bool
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator!=( const StaticEllpackIndexMultimapValues& other ) const
operator!=( const StaticEllpackIndexMultimapValues& other ) const