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

Fixes in smart pointers

parent eb7eabc4
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -14,14 +14,13 @@

#include <TNL/Devices/Host.h>
#include <TNL/Devices/Cuda.h>
#include <TNL/Pointers/SmartPointer.h>

#include <cstring>

#include <TNL/Devices/MIC.h>
#include <TNL/Pointers/SmartPointer.h>

#include <cstring>  // std::memcpy, std::memcmp

namespace TNL {
namespace Pointers {

/***
 * The DevicePointer is like SharedPointer, except it takes an existing host
@@ -774,4 +773,5 @@ struct Formatter< DevicePointer< Object, Device > >
} // namespace Assert
#endif

} // namespace Pointers
} // namespace TNL
+19 −17
Original line number Diff line number Diff line
@@ -12,12 +12,12 @@

#pragma once

#include <TNL/Assert.h>
#include "SharedPointer.h"

#include <TNL/Devices/Cuda.h>
#include <TNL/Devices/MIC.h>
#include <TNL/Pointers/SmartPointer.h>

#include <cstring>
#include <cstring>  // std::memcpy, std::memcmp
#include <cstddef>  // std::nullptr_t

//#define TNL_DEBUG_SHARED_POINTERS
@@ -290,7 +290,9 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer

      PointerData* pd;
};

#else // HAVE_CUDA_UNIFIED_MEMORY

template< typename Object >
class SharedPointer< Object, Devices::Cuda > : public SmartPointer
{
+13 −9
Original line number Diff line number Diff line
@@ -12,10 +12,14 @@

#pragma once

#include "SharedPointer.h"

#include <TNL/Devices/Host.h>
#include <TNL/Devices/Cuda.h>
#include <TNL/Devices/CudaCallable.h>
#include <TNL/Pointers/SmartPointer.h>

#include <cstddef>  // std::nullptr_t

namespace TNL {
namespace Pointers {

+15 −13
Original line number Diff line number Diff line
@@ -12,16 +12,18 @@

#pragma once

#include "SharedPointer.h"

#include <TNL/Devices/MIC.h>
#include <TNL/Pointers/SmartPointer.h>

#include <cstring>  // std::memcpy, std::memcmp
#include <cstddef>  // std::nullptr_t

namespace TNL {
namespace Pointers {

#ifdef HAVE_MIC
/****
 * Specialization for MIC
 */
template< typename Object>
class SharedPointer< Object, Devices::MIC > : public SmartPointer
{
+5 −13
Original line number Diff line number Diff line
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

/***************************************************************************
                          SmartPointer.h  -  description
                             -------------------
@@ -15,6 +6,8 @@
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

#pragma once

class SmartPointer
@@ -24,4 +17,3 @@ class SmartPointer
      virtual bool synchronize() = 0;

};
Loading