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

Moved stuff from MIC.cpp to MIC.h

parent 08b12e35
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ set (headers Cuda.h

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/TNL/Devices )
set( common_SOURCES
     ${CURRENT_DIR}/MIC.cpp
     ${CURRENT_DIR}/SystemInfo.cpp )

IF( BUILD_CUDA )

src/TNL/Devices/MIC.cpp

deleted100644 → 0
+0 −41
Original line number Diff line number Diff line
/***************************************************************************
                          MIC.cpp  -  description
                             -------------------
    begin                : Feb 10, 2017
    copyright            : (C) 2017 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

// Implemented by: Vit Hanousek

#include <TNL/Devices/MIC.h>

namespace TNL {
namespace Devices {
	
SmartPointersRegister MIC::smartPointersRegister;
Timer MIC::smartPointersSynchronizationTimer;

void MIC::insertSmartPointer( SmartPointer* pointer )
{
   smartPointersRegister.insert( pointer, -1 );
}

void MIC::removeSmartPointer( SmartPointer* pointer )
{
   smartPointersRegister.remove( pointer, -1 );
}

bool MIC::synchronizeDevice( int deviceId )
{
   smartPointersSynchronizationTimer.start();
   bool b = smartPointersRegister.synchronizeDevice( deviceId );
   smartPointersSynchronizationTimer.stop();
   return b;
}


} // namespace Devices
} // namespace TNL
 No newline at end of file
+43 −32
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@


namespace TNL {

namespace Devices {
namespace {

//useful macros from Intel's tutorials -- but we do not use it, becaouse it is tricky (system of maping variables CPU-MIC)
#define ALLOC alloc_if(1) //alloac variable at begining of offloaded block -- default
@@ -156,24 +156,35 @@ class MIC

#endif

   static void insertSmartPointer( SmartPointer* pointer );
   static void insertSmartPointer( SmartPointer* pointer )
   {
      smartPointersRegister.insert( pointer, -1 );
   }

   static void removeSmartPointer( SmartPointer* pointer );
   static void removeSmartPointer( SmartPointer* pointer )
   {
      smartPointersRegister.remove( pointer, -1 );
   }

   // Negative deviceId means that CudaDeviceInfo::getActiveDevice will be
   // called to get the device ID.
   static bool synchronizeDevice( int deviceId = -1 );
   static bool synchronizeDevice( int deviceId = -1 )
   {
      smartPointersSynchronizationTimer.start();
      bool b = smartPointersRegister.synchronizeDevice( deviceId );
      smartPointersSynchronizationTimer.stop();
      return b;
   }

   static Timer smartPointersSynchronizationTimer;

protected:
   
   static SmartPointersRegister smartPointersRegister;

};

}//namespace Devices
SmartPointersRegister MIC::smartPointersRegister;
Timer MIC::smartPointersSynchronizationTimer;

} // namespace <unnamed>
} // namespace Devices
} // namespace TNL