Commit 2995e4e9 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added __cuda_callable__ to tnlSharedVector's constructor

Problem with marking tnlObject's virtual destructor as __cuda_callable__
is yet to be solved...
parent 2e198d90
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -44,13 +44,17 @@ class tnlSharedArray : public tnlObject
   typedef tnlSharedArray< Element, tnlHost, Index > HostType;
   typedef tnlSharedArray< Element, tnlCuda, Index > CudaType;

   __cuda_callable__
   tnlSharedArray();

   __cuda_callable__
   tnlSharedArray( Element* _data,
                   const Index _size );

   __cuda_callable__
   tnlSharedArray( tnlArray< Element, Device, Index >& array );

   __cuda_callable__
   tnlSharedArray( tnlSharedArray< Element, Device, Index >& array );

   static tnlString getType();
@@ -61,17 +65,21 @@ class tnlSharedArray : public tnlObject

   virtual tnlString getSerializationTypeVirtual() const;

   __cuda_callable__
   void bind( Element* _data,
              const Index _size );

   template< typename Array >
   __cuda_callable__
   void bind( Array& array,
              IndexType index = 0,
              IndexType size = 0 );

   template< int Size >
   __cuda_callable__
   void bind( tnlStaticArray< Size, Element >& array );

   __cuda_callable__
   void bind( tnlSharedArray< Element, Device, Index >& array );

   void swap( tnlSharedArray< Element, Device, Index >& array );
+8 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ using namespace std;
template< typename Element,
          typename Device,
          typename Index >
__cuda_callable__
tnlSharedArray< Element, Device, Index >::tnlSharedArray()
: size( 0 ), data( 0 )
{
@@ -39,6 +40,7 @@ tnlSharedArray< Element, Device, Index >::tnlSharedArray()
template< typename Element,
          typename Device,
          typename Index >
__cuda_callable__
tnlSharedArray< Element, Device, Index >::tnlSharedArray( Element* _data,
                                                          const Index _size )
{
@@ -48,6 +50,7 @@ tnlSharedArray< Element, Device, Index >::tnlSharedArray( Element* _data,
template< typename Element,
          typename Device,
          typename Index >
__cuda_callable__
tnlSharedArray< Element, Device, Index >::tnlSharedArray( tnlArray< Element, Device, Index >& array )
{
   this->bind( array );
@@ -56,6 +59,7 @@ tnlSharedArray< Element, Device, Index >::tnlSharedArray( tnlArray< Element, Dev
template< typename Element,
          typename Device,
          typename Index >
__cuda_callable__
tnlSharedArray< Element, Device, Index >::tnlSharedArray( tnlSharedArray< Element, Device, Index >& array )
{
   this->bind( array );
@@ -99,6 +103,7 @@ tnlString tnlSharedArray< Element, Device, Index > :: getSerializationTypeVirtua
template< typename Element,
          typename Device,
          typename Index >
__cuda_callable__
void tnlSharedArray< Element, Device, Index > :: bind( Element* data,
                                                       const Index size )
{
@@ -116,6 +121,7 @@ template< typename Element,
          typename Device,
          typename Index >
   template< typename Array >
__cuda_callable__
void tnlSharedArray< Element, Device, Index > :: bind( Array& array,
                                                       IndexType index,
                                                       IndexType size )
@@ -134,6 +140,7 @@ template< typename Element,
          typename Device,
          typename Index >
   template< int Size >
__cuda_callable__
void tnlSharedArray< Element, Device, Index >::bind( tnlStaticArray< Size, Element >& array )
{
   this->size = Size;
@@ -143,6 +150,7 @@ void tnlSharedArray< Element, Device, Index >::bind( tnlStaticArray< Size, Eleme
template< typename Element,
          typename Device,
          typename Index >
__cuda_callable__
void tnlSharedArray< Element, Device, Index > :: bind( tnlSharedArray< Element, Device, Index >& array )
{
   this -> size = array. getSize();
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
#include <core/mfuncs.h>
#include <core/tnlAssert.h>
#include <core/tnlString.h>
#include <core/tnlObject.h>
#include <core/tnlHost.h>
#include <core/tnlCuda.h>

+7 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#ifndef tnlObjectH
#define tnlObjectH

#include <core/tnlCuda.h>
#include <core/tnlString.h>

class tnlFile;
@@ -39,11 +40,9 @@ class tnlObject
   public:

   //! Basic constructor
   __cuda_callable__
   tnlObject();

   //! Constructor with name
   tnlObject( const tnlString& name );

   /****
    * Type getter. This returns the type in C++ style - for example the returned value
    * may look as follows: "tnlVector< double, tnlCuda >".
@@ -72,6 +71,9 @@ class tnlObject
   bool load( const tnlString& fileName );

   //! Destructor
   // FIXME: __cuda_callable__ would have to be added to every overriding destructor,
   // even if the object's constructor is not __cuda_callable__
//   __cuda_callable__
   virtual ~tnlObject(){};

};
@@ -83,4 +85,6 @@ bool getObjectType( const tnlString& file_name, tnlString& type );
bool parseObjectType( const tnlString& objectType,
                      tnlList< tnlString >& parsedObjectType );

#include <core/tnlObject_impl.h>

#endif
+5 −6
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@
 *                                                                         *
 ***************************************************************************/

#ifndef tnlObject_H_IMPLEMENTATION
#define tnlObject_H_IMPLEMENTATION

#include <core/tnlObject.h>
#include <debug/tnlDebug.h>
#include <core/tnlAssert.h>
@@ -27,15 +30,11 @@

const char magic_number[] = "TNLMN";

__cuda_callable__
tnlObject :: tnlObject()
{
}


tnlObject :: tnlObject( const tnlString& _name )
{
}

tnlString tnlObject :: getType()
{
   return tnlString( "tnlObject" );
@@ -207,4 +206,4 @@ bool parseObjectType( const tnlString& objectType,
   return true;
}

#endif /* tnlObject_H_IMPLEMENTATION */
Loading