Commit 9723c16b authored by Jakub Klinkovský's avatar Jakub Klinkovský

Moved skipping of synchronization directly into the synchronizeSmartPointersOnDevice function

parent 9615d107
......@@ -37,8 +37,7 @@ processBoundaryEntities( const MeshPointer& meshPointer,
// TODO: if the Mesh::IdType is void, then we should also pass the entityIndex
EntitiesProcessor::processEntity( *mesh, userData, entity );
};
if( std::is_same< DeviceType, Devices::Cuda >::value )
Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
Algorithms::ParallelFor< DeviceType >::exec(
(GlobalIndexType) 0, entitiesCount,
kernel,
......@@ -67,8 +66,7 @@ processInteriorEntities( const MeshPointer& meshPointer,
// TODO: if the Mesh::IdType is void, then we should also pass the entityIndex
EntitiesProcessor::processEntity( *mesh, userData, entity );
};
if( std::is_same< DeviceType, Devices::Cuda >::value )
Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
Algorithms::ParallelFor< DeviceType >::exec(
(GlobalIndexType) 0, entitiesCount,
kernel,
......@@ -96,8 +94,7 @@ processAllEntities( const MeshPointer& meshPointer,
// TODO: if the Mesh::IdType is void, then we should also pass the entityIndex
EntitiesProcessor::processEntity( *mesh, userData, entity );
};
if( std::is_same< DeviceType, Devices::Cuda >::value )
Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
Algorithms::ParallelFor< DeviceType >::exec(
(GlobalIndexType) 0, entitiesCount,
kernel,
......
......@@ -16,6 +16,8 @@
#include <TNL/Pointers/SmartPointer.h>
#include <TNL/Timer.h>
#include <TNL/Cuda/DeviceInfo.h>
#include <TNL/Devices/Sequential.h>
#include <TNL/Devices/Host.h>
namespace TNL {
namespace Pointers {
......@@ -109,6 +111,10 @@ Timer& getSmartPointersSynchronizationTimer()
template< typename Device >
bool synchronizeSmartPointersOnDevice( int deviceId = -1 )
{
// TODO: better way to skip synchronization of host-only smart pointers
if( std::is_same< Device, Devices::Sequential >::value || std::is_same< Device, Devices::Host >::value )
return true;
getSmartPointersSynchronizationTimer< Device >().start();
bool b = getSmartPointersRegister< Device >().synchronizeDevice( deviceId );
getSmartPointersSynchronizationTimer< Device >().stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment