Loading CuckooHash/CuckooHashTableView.hpp +10 −2 Original line number Diff line number Diff line Loading @@ -127,8 +127,16 @@ bool CuckooHashTableView<Item, Key, Device>::find(const Key& key, Item* item) co TNL::Algorithms::ParallelFor<Device>::exec(0, m_hashFunctions.getSize(), _find, m_hashFunctions, m_table, m_content); int result = rview.getElement(0); if (result >= 0) { if (item) if (item) { if constexpr (std::is_same<TNL::Devices::Cuda, Device>::value) { #ifdef __HAVE_CUDA__ // TODO Maybe there is a faster way? cudaMemcpy((void*)item, (void*)m_content.getData()[m_table.getElement(result)], sizeof(Item), cudaMemcpyDeviceToHost); #endif } else *item = m_content.getElement(m_table.getElement(result)).item; } return true; } return false; Loading Loading
CuckooHash/CuckooHashTableView.hpp +10 −2 Original line number Diff line number Diff line Loading @@ -127,8 +127,16 @@ bool CuckooHashTableView<Item, Key, Device>::find(const Key& key, Item* item) co TNL::Algorithms::ParallelFor<Device>::exec(0, m_hashFunctions.getSize(), _find, m_hashFunctions, m_table, m_content); int result = rview.getElement(0); if (result >= 0) { if (item) if (item) { if constexpr (std::is_same<TNL::Devices::Cuda, Device>::value) { #ifdef __HAVE_CUDA__ // TODO Maybe there is a faster way? cudaMemcpy((void*)item, (void*)m_content.getData()[m_table.getElement(result)], sizeof(Item), cudaMemcpyDeviceToHost); #endif } else *item = m_content.getElement(m_table.getElement(result)).item; } return true; } return false; Loading