Loading src/TNL/Pointers/CMakeLists.txt +0 −15 Original line number Diff line number Diff line Loading @@ -8,19 +8,4 @@ SET( headers DevicePointer.h UniquePointer.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/TNL/Pointers ) set( common_SOURCES ${CURRENT_DIR}/SmartPointersRegister.cpp ) SET( tnl_pointers_SOURCES ${common_SOURCES} PARENT_SCOPE ) if( BUILD_CUDA ) SET( tnl_pointers_CUDA__SOURCES ${common_SOURCES} PARENT_SCOPE ) endif() INSTALL( FILES ${headers} DESTINATION ${TNL_TARGET_INCLUDE_DIRECTORY}/Pointers ) src/TNL/Pointers/SmartPointersRegister.cppdeleted 100644 → 0 +0 −53 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. * * * ***************************************************************************/ /*************************************************************************** SmartPointersRegister.cpp - description ------------------- begin : Apr 29, 2016 copyright : (C) 2016 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ #include <iostream> #include <TNL/Pointers/SmartPointersRegister.h> #include <TNL/Devices/Cuda.h> void SmartPointersRegister::insert( SmartPointer* pointer, int deviceId ) { //std::cerr << "Inserting pointer " << pointer << " to the register..." << std::endl; pointersOnDevices[ deviceId ].insert( pointer ); } void SmartPointersRegister::remove( SmartPointer* pointer, int deviceId ) { try { pointersOnDevices.at( deviceId ).erase( pointer ); } catch( const std::out_of_range& ) { std::cerr << "Given deviceId " << deviceId << " does not have any pointers yet. " << "Requested to remove pointer " << pointer << ". " << "This is most likely a bug in the smart pointer." << std::endl; throw; } } bool SmartPointersRegister::synchronizeDevice( int deviceId ) { try { const auto & set = pointersOnDevices.at( deviceId ); for( auto&& it : set ) ( *it ).synchronize(); TNL_CHECK_CUDA_DEVICE; return true; } catch( const std::out_of_range& ) { return false; } } src/TNL/Pointers/SmartPointersRegister.h +30 −5 Original line number Diff line number Diff line Loading @@ -20,11 +20,36 @@ class SmartPointersRegister public: void insert( SmartPointer* pointer, int deviceId ); void remove( SmartPointer* pointer, int deviceId ); void insert( SmartPointer* pointer, int deviceId ) { pointersOnDevices[ deviceId ].insert( pointer ); } bool synchronizeDevice( int deviceId ); void remove( SmartPointer* pointer, int deviceId ) { try { pointersOnDevices.at( deviceId ).erase( pointer ); } catch( const std::out_of_range& ) { std::cerr << "Given deviceId " << deviceId << " does not have any pointers yet. " << "Requested to remove pointer " << pointer << ". " << "This is most likely a bug in the smart pointer." << std::endl; throw; } } bool synchronizeDevice( int deviceId ) { try { const auto & set = pointersOnDevices.at( deviceId ); for( auto&& it : set ) ( *it ).synchronize(); return true; } catch( const std::out_of_range& ) { return false; } } protected: Loading Loading
src/TNL/Pointers/CMakeLists.txt +0 −15 Original line number Diff line number Diff line Loading @@ -8,19 +8,4 @@ SET( headers DevicePointer.h UniquePointer.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/TNL/Pointers ) set( common_SOURCES ${CURRENT_DIR}/SmartPointersRegister.cpp ) SET( tnl_pointers_SOURCES ${common_SOURCES} PARENT_SCOPE ) if( BUILD_CUDA ) SET( tnl_pointers_CUDA__SOURCES ${common_SOURCES} PARENT_SCOPE ) endif() INSTALL( FILES ${headers} DESTINATION ${TNL_TARGET_INCLUDE_DIRECTORY}/Pointers )
src/TNL/Pointers/SmartPointersRegister.cppdeleted 100644 → 0 +0 −53 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. * * * ***************************************************************************/ /*************************************************************************** SmartPointersRegister.cpp - description ------------------- begin : Apr 29, 2016 copyright : (C) 2016 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ #include <iostream> #include <TNL/Pointers/SmartPointersRegister.h> #include <TNL/Devices/Cuda.h> void SmartPointersRegister::insert( SmartPointer* pointer, int deviceId ) { //std::cerr << "Inserting pointer " << pointer << " to the register..." << std::endl; pointersOnDevices[ deviceId ].insert( pointer ); } void SmartPointersRegister::remove( SmartPointer* pointer, int deviceId ) { try { pointersOnDevices.at( deviceId ).erase( pointer ); } catch( const std::out_of_range& ) { std::cerr << "Given deviceId " << deviceId << " does not have any pointers yet. " << "Requested to remove pointer " << pointer << ". " << "This is most likely a bug in the smart pointer." << std::endl; throw; } } bool SmartPointersRegister::synchronizeDevice( int deviceId ) { try { const auto & set = pointersOnDevices.at( deviceId ); for( auto&& it : set ) ( *it ).synchronize(); TNL_CHECK_CUDA_DEVICE; return true; } catch( const std::out_of_range& ) { return false; } }
src/TNL/Pointers/SmartPointersRegister.h +30 −5 Original line number Diff line number Diff line Loading @@ -20,11 +20,36 @@ class SmartPointersRegister public: void insert( SmartPointer* pointer, int deviceId ); void remove( SmartPointer* pointer, int deviceId ); void insert( SmartPointer* pointer, int deviceId ) { pointersOnDevices[ deviceId ].insert( pointer ); } bool synchronizeDevice( int deviceId ); void remove( SmartPointer* pointer, int deviceId ) { try { pointersOnDevices.at( deviceId ).erase( pointer ); } catch( const std::out_of_range& ) { std::cerr << "Given deviceId " << deviceId << " does not have any pointers yet. " << "Requested to remove pointer " << pointer << ". " << "This is most likely a bug in the smart pointer." << std::endl; throw; } } bool synchronizeDevice( int deviceId ) { try { const auto & set = pointersOnDevices.at( deviceId ); for( auto&& it : set ) ( *it ).synchronize(); return true; } catch( const std::out_of_range& ) { return false; } } protected: Loading