diff --git a/core/src/Kokkos_HBWSpace.hpp b/core/src/Kokkos_HBWSpace.hpp index d9064a2983..369b7bafb7 100644 --- a/core/src/Kokkos_HBWSpace.hpp +++ b/core/src/Kokkos_HBWSpace.hpp @@ -31,41 +31,6 @@ namespace Kokkos { namespace Experimental { -namespace Impl { - -/// \brief Initialize lock array for arbitrary size atomics. -/// -/// Arbitrary atomics are implemented using a hash table of locks -/// where the hash value is derived from the address of the -/// object for which an atomic operation is performed. -/// This function initializes the locks to zero (unset). -void init_lock_array_hbw_space(); - -/// \brief Acquire a lock for the address -/// -/// This function tries to acquire the lock for the hash value derived -/// from the provided ptr. If the lock is successfully acquired the -/// function returns true. Otherwise it returns false. -bool lock_address_hbw_space(void* ptr); - -/// \brief Release lock for the address -/// -/// This function releases the lock for the hash value derived -/// from the provided ptr. This function should only be called -/// after previously successfully acquiring a lock with -/// lock_address. -void unlock_address_hbw_space(void* ptr); - -} // namespace Impl - -} // namespace Experimental - -} // namespace Kokkos - -namespace Kokkos { - -namespace Experimental { - /// \class HBWSpace /// \brief Memory management for host memory. /// diff --git a/core/src/Kokkos_HostSpace.hpp b/core/src/Kokkos_HostSpace.hpp index 4b839aca05..0c8cd43a04 100644 --- a/core/src/Kokkos_HostSpace.hpp +++ b/core/src/Kokkos_HostSpace.hpp @@ -41,37 +41,6 @@ static_assert(false, /*--------------------------------------------------------------------------*/ -namespace Kokkos { - -namespace Impl { - -/// \brief Initialize lock array for arbitrary size atomics. -/// -/// Arbitrary atomics are implemented using a hash table of locks -/// where the hash value is derived from the address of the -/// object for which an atomic operation is performed. -/// This function initializes the locks to zero (unset). -void init_lock_array_host_space(); - -/// \brief Acquire a lock for the address -/// -/// This function tries to acquire the lock for the hash value derived -/// from the provided ptr. If the lock is successfully acquired the -/// function returns true. Otherwise it returns false. -bool lock_address_host_space(void* ptr); - -/// \brief Release lock for the address -/// -/// This function releases the lock for the hash value derived -/// from the provided ptr. This function should only be called -/// after previously successfully acquiring a lock with -/// lock_address. -void unlock_address_host_space(void* ptr); - -} // namespace Impl - -} // namespace Kokkos - namespace Kokkos { /// \class HostSpace /// \brief Memory management for host memory. diff --git a/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp b/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp index e1434a4275..fbf44c0164 100644 --- a/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp +++ b/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp @@ -324,8 +324,6 @@ void OpenMPInternal::initialize(int thread_count) { std::cerr << " Requested: " << thread_count << " threads per process." << std::endl; } - // Init the array used for arbitrarily sized atomics - init_lock_array_host_space(); m_initialized = true; } diff --git a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp index de8e629831..81fbc56de0 100644 --- a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp +++ b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp @@ -165,39 +165,6 @@ SharedAllocationRecord:: } // namespace Impl } // namespace Kokkos -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ -/* -namespace Kokkos { -namespace { - const unsigned HOST_SPACE_ATOMIC_MASK = 0xFFFF; - const unsigned HOST_SPACE_ATOMIC_XOR_MASK = 0x5A39; - static int HOST_SPACE_ATOMIC_LOCKS[HOST_SPACE_ATOMIC_MASK+1]; -} - -namespace Impl { -void init_lock_array_host_space() { - static int is_initialized = 0; - if(! is_initialized) - for(int i = 0; i < static_cast (HOST_SPACE_ATOMIC_MASK+1); i++) - HOST_SPACE_ATOMIC_LOCKS[i] = 0; -} - -bool lock_address_host_space(void* ptr) { - return 0 == atomic_compare_exchange( &HOST_SPACE_ATOMIC_LOCKS[ - (( size_t(ptr) >> 2 ) & HOST_SPACE_ATOMIC_MASK) ^ -HOST_SPACE_ATOMIC_XOR_MASK] , 0 , 1); -} - -void unlock_address_host_space(void* ptr) { - atomic_exchange( &HOST_SPACE_ATOMIC_LOCKS[ - (( size_t(ptr) >> 2 ) & HOST_SPACE_ATOMIC_MASK) ^ -HOST_SPACE_ATOMIC_XOR_MASK] , 0); -} - -} -}*/ - //============================================================================== // {{{1 diff --git a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp index ca015da379..e5b33d0982 100644 --- a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp +++ b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp @@ -35,37 +35,6 @@ static_assert(false, #include #include -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Impl { - -/// \brief Initialize lock array for arbitrary size atomics. -/// -/// Arbitrary atomics are implemented using a hash table of locks -/// where the hash value is derived from the address of the -/// object for which an atomic operation is performed. -/// This function initializes the locks to zero (unset). -// void init_lock_array_host_space(); - -/// \brief Acquire a lock for the address -/// -/// This function tries to acquire the lock for the hash value derived -/// from the provided ptr. If the lock is successfully acquired the -/// function returns true. Otherwise it returns false. -// bool lock_address_host_space(void* ptr); - -/// \brief Release lock for the address -/// -/// This function releases the lock for the hash value derived -/// from the provided ptr. This function should only be called -/// after previously successfully acquiring a lock with -/// lock_address. -// void unlock_address_host_space(void* ptr); - -} // namespace Impl -} // namespace Kokkos - namespace Kokkos { namespace Impl { diff --git a/core/src/Serial/Kokkos_Serial.cpp b/core/src/Serial/Kokkos_Serial.cpp index b5a1fcdd79..52e3d68bdf 100644 --- a/core/src/Serial/Kokkos_Serial.cpp +++ b/core/src/Serial/Kokkos_Serial.cpp @@ -42,9 +42,6 @@ void SerialInternal::initialize() { Impl::SharedAllocationRecord::tracking_enable(); - // Init the array of locks used for arbitrarily sized atomics - Impl::init_lock_array_host_space(); - m_is_initialized = true; } diff --git a/core/src/Threads/Kokkos_ThreadsExec.cpp b/core/src/Threads/Kokkos_ThreadsExec.cpp index 8f39c726c7..c754091e87 100644 --- a/core/src/Threads/Kokkos_ThreadsExec.cpp +++ b/core/src/Threads/Kokkos_ThreadsExec.cpp @@ -768,9 +768,6 @@ void ThreadsExec::initialize(int thread_count_arg) { << thread_count << " threads per process." << std::endl; } - // Init the array for used for arbitrarily sized atomics - Impl::init_lock_array_host_space(); - Impl::SharedAllocationRecord::tracking_enable(); } diff --git a/core/src/impl/Kokkos_HBWSpace.cpp b/core/src/impl/Kokkos_HBWSpace.cpp index 7402f1a744..cd640b88cb 100644 --- a/core/src/impl/Kokkos_HBWSpace.cpp +++ b/core/src/impl/Kokkos_HBWSpace.cpp @@ -310,41 +310,4 @@ void SharedAllocationRecord:: } // namespace Impl } // namespace Kokkos -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Experimental { -namespace { -const unsigned HBW_SPACE_ATOMIC_MASK = 0xFFFF; -const unsigned HBW_SPACE_ATOMIC_XOR_MASK = 0x5A39; -static int HBW_SPACE_ATOMIC_LOCKS[HBW_SPACE_ATOMIC_MASK + 1]; -} // namespace - -namespace Impl { -void init_lock_array_hbw_space() { - static int is_initialized = 0; - if (!is_initialized) - for (int i = 0; i < static_cast(HBW_SPACE_ATOMIC_MASK + 1); i++) - HBW_SPACE_ATOMIC_LOCKS[i] = 0; -} - -bool lock_address_hbw_space(void *ptr) { - return 0 == atomic_compare_exchange( - &HBW_SPACE_ATOMIC_LOCKS[((size_t(ptr) >> 2) & - HBW_SPACE_ATOMIC_MASK) ^ - HBW_SPACE_ATOMIC_XOR_MASK], - 0, 1); -} - -void unlock_address_hbw_space(void *ptr) { - atomic_exchange( - &HBW_SPACE_ATOMIC_LOCKS[((size_t(ptr) >> 2) & HBW_SPACE_ATOMIC_MASK) ^ - HBW_SPACE_ATOMIC_XOR_MASK], - 0); -} - -} // namespace Impl -} // namespace Experimental -} // namespace Kokkos #endif diff --git a/core/src/impl/Kokkos_HostSpace.cpp b/core/src/impl/Kokkos_HostSpace.cpp index b47ce3beec..857340ae09 100644 --- a/core/src/impl/Kokkos_HostSpace.cpp +++ b/core/src/impl/Kokkos_HostSpace.cpp @@ -284,42 +284,6 @@ SharedAllocationRecord::SharedAllocationRecord( } // namespace Impl } // namespace Kokkos -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace { -const unsigned HOST_SPACE_ATOMIC_MASK = 0xFFFF; -const unsigned HOST_SPACE_ATOMIC_XOR_MASK = 0x5A39; -static int HOST_SPACE_ATOMIC_LOCKS[HOST_SPACE_ATOMIC_MASK + 1]; -} // namespace - -namespace Impl { -void init_lock_array_host_space() { - static int is_initialized = 0; - if (!is_initialized) - for (int i = 0; i < static_cast(HOST_SPACE_ATOMIC_MASK + 1); i++) - HOST_SPACE_ATOMIC_LOCKS[i] = 0; -} - -bool lock_address_host_space(void *ptr) { - return 0 == atomic_compare_exchange( - &HOST_SPACE_ATOMIC_LOCKS[((size_t(ptr) >> 2) & - HOST_SPACE_ATOMIC_MASK) ^ - HOST_SPACE_ATOMIC_XOR_MASK], - 0, 1); -} - -void unlock_address_host_space(void *ptr) { - atomic_exchange( - &HOST_SPACE_ATOMIC_LOCKS[((size_t(ptr) >> 2) & HOST_SPACE_ATOMIC_MASK) ^ - HOST_SPACE_ATOMIC_XOR_MASK], - 0); -} - -} // namespace Impl -} // namespace Kokkos - //============================================================================== // {{{1