Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TBB. #1932

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ jobs:
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_GPU=${ENABLE_GPU:-"OFF"} \
-DENABLE_MPI=${ENABLE_MPI:-"OFF"} \
-DENABLE_TBB=${ENABLE_TBB:-"OFF"} \
-DBUILD_MD=${BUILD_MD:-"ON"} \
-DBUILD_MPCD=${BUILD_MD:-"ON"} \
-DBUILD_METAL=${BUILD_MD:-"ON"} \
Expand All @@ -167,7 +166,6 @@ jobs:
env:
ENABLE_GPU: ${{ contains(inputs.config, 'cuda') }}
ENABLE_MPI: ${{ contains(inputs.config, 'mpi') }}
ENABLE_TBB: ${{ contains(inputs.config, 'tbb') }}
BUILD_MD: ${{ !contains(inputs.config, 'nomd') }}
BUILD_HPMC: ${{ !contains(inputs.config, 'nohpmc') }}
BUILD_DEBUG: ${{ contains(inputs.config, 'debug') }}
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
fail-fast: false
matrix:
include:
- config: [clang, 18, -py, 313, -mpi, -tbb]
- config: [clang, 18, -py, 313, -mpi]
validate: true

- config: [gcc, 14, -py, 313]
Expand All @@ -51,7 +51,7 @@ jobs:
- config: [gcc, 14, -py, 313, -nomd]
- config: [gcc, 14, -py, 313, -nohpmc]
- config: [gcc, 14, -py, 313, -nomd, -nohpmc]
- config: [gcc, 10, -py, 39, -mpi, -tbb]
- config: [gcc, 10, -py, 39, -mpi]

- config: [cuda, 125, -py, 313, -mpi]
validate: true
Expand Down Expand Up @@ -85,17 +85,17 @@ jobs:
fail-fast: false
matrix:
include:
- config: [clang, 17, -py, 313, -mpi, -tbb]
- config: [clang, 17, -py, 312, -mpi, -tbb]
- config: [clang, 16, -py, 312, -mpi, -tbb]
- config: [clang, 15, -py, 311, -mpi, -tbb]
- config: [clang, 14, -py, 310, -mpi, -tbb]
- config: [clang, 13, -py, 39, -mpi, -tbb]
- config: [gcc, 13, -py, 313, -mpi, -tbb]
- config: [gcc, 13, -py, 312, -mpi, -tbb]
- config: [gcc, 12, -py, 311, -mpi, -tbb]
- config: [gcc, 11, -py, 310, -mpi, -tbb]
- config: [gcc, 10, -py, 310, -mpi, -tbb]
- config: [clang, 17, -py, 313, -mpi]
- config: [clang, 17, -py, 312, -mpi]
- config: [clang, 16, -py, 312, -mpi]
- config: [clang, 15, -py, 311, -mpi]
- config: [clang, 14, -py, 310, -mpi]
- config: [clang, 13, -py, 39, -mpi]
- config: [gcc, 13, -py, 313, -mpi]
- config: [gcc, 13, -py, 312, -mpi]
- config: [gcc, 12, -py, 311, -mpi]
- config: [gcc, 11, -py, 310, -mpi]
- config: [gcc, 10, -py, 310, -mpi]

tests_complete:
name: Unit test
Expand Down
1 change: 1 addition & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
!.github
hoomd/extern
sphinx-doc/tutorial
12 changes: 1 addition & 11 deletions BUILDING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ Install prerequisites
---------------------

You will need to install a number of tools and libraries to build **HOOMD-blue**. The options
``ENABLE_MPI``, ``ENABLE_GPU``, and ``ENABLE_TBB`` each require additional
libraries when enabled.
``ENABLE_MPI`` and ``ENABLE_GPU`` each require additional libraries when enabled.

Install the required dependencies:

Expand Down Expand Up @@ -142,10 +141,6 @@ Install additional packages needed to build the documentation:
When ``ENABLE_GPU=on``, HOOMD-blue will default to CUDA. Set ``HOOMD_GPU_PLATFORM=HIP`` to
choose HIP.

**For threaded parallelism on the CPU** (required when ``ENABLE_TBB=on``):

- **Intel Threading Building Blocks**

**To build the documentation:**

- **sphinx**
Expand Down Expand Up @@ -260,11 +255,6 @@ Other option changes take effect at any time:
- When set to ``on``, multi-processor/multi-GPU simulations are supported.
- When set to ``off`` (the default), always run in single-processor/single-GPU mode.

- ``ENABLE_TBB`` - Enable support for Intel's Threading Building Blocks (TBB).

- When set to ``on``, **HOOMD-blue** will use TBB to speed up calculations in some classes on
multiple CPU cores.

- ``PYTHON_SITE_INSTALL_DIR`` - Directory to install ``hoomd`` to relative to
``CMAKE_INSTALL_PREFIX``. Defaults to the ``site-packages`` directory used by the found Python
executable.
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Change Log
(`#1888 <https://github.com/glotzerlab/hoomd-blue/pull/1888>`__).
* Implicit depletants from HPMC.
(`#1931 <https://github.com/glotzerlab/hoomd-blue/pull/1931>`__).
* ``Device.num_cpu_threads``.
(`#1932 <https://github.com/glotzerlab/hoomd-blue/pull/1932>`__).


4.x
Expand Down
41 changes: 0 additions & 41 deletions CMake/hoomd/FindTBB.cmake

This file was deleted.

6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ else()
option(BUILD_MPCD "Build the mpcd package" ${BUILD_MD})
endif()

# Optionally use TBB for threading
option(ENABLE_TBB "Enable support for Threading Building Blocks (TBB)" off)

# Add list of plugins
set(PLUGINS "example_plugins/pair_plugin;example_plugins/updater_plugin;example_plugins/shape_plugin" CACHE STRING "List of plugin directories.")

Expand Down Expand Up @@ -212,8 +209,7 @@ configure_package_config_file(hoomd-config.cmake.in
INSTALL_DESTINATION ${CONFIG_INSTALL_DIR}
PATH_VARS CMAKE_INSTALL_PREFIX)

install(FILES CMake/hoomd/FindTBB.cmake
CMake/hoomd/FindCUDALibs.cmake
install(FILES CMake/hoomd/FindCUDALibs.cmake
CMake/hoomd/HOOMDHIPSetup.cmake
CMake/hoomd/hoomd-macros.cmake
${HOOMD_BINARY_DIR}/hoomd-config.cmake
Expand Down
5 changes: 0 additions & 5 deletions hoomd-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ set(HIP_PLATFORM "@HIP_PLATFORM@")
set(ENABLE_NVTOOLS "@ENABLE_NVTOOLS@")
set(ENABLE_ROCTRACER "@ENABLE_ROCTRACER@")
set(ENABLE_MPI "@ENABLE_MPI@")
set(ENABLE_TBB "@ENABLE_TBB@")
set(ALWAYS_USE_MANAGED_MEMORY "@ALWAYS_USE_MANAGED_MEMORY@")

# CUDA architectures
Expand Down Expand Up @@ -82,10 +81,6 @@ if (ENABLE_MPI)
endif()
endif()

if (ENABLE_TBB)
find_dependency(TBB 4.3 REQUIRED)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/hoomd-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/hoomd-macros.cmake")

Expand Down
14 changes: 0 additions & 14 deletions hoomd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,20 +298,6 @@ if (ENABLE_HIP)
endif()


# Libraries and compile definitions for TBB enabled builds
if (ENABLE_TBB)
find_package_config_first(TBB 4.3)

if (TBB_FOUND)
get_target_property(_tbb_library TBB::tbb IMPORTED_LOCATION_RELEASE)
get_target_property(_tbb_include_dir TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
find_package_message(tbb "Found TBB: ${TBB_DIR} ${_tbb_library} ${_tbb_include_dir}" "[${_tbb_library}][${_tbb_include_dir}]")
endif()

target_compile_definitions(_hoomd PUBLIC ENABLE_TBB)
target_link_libraries(_hoomd PUBLIC TBB::tbb)
endif()

# Libraries and compile definitions for MPI enabled builds
if (ENABLE_MPI)
target_compile_definitions(_hoomd PUBLIC ENABLE_MPI)
Expand Down
18 changes: 0 additions & 18 deletions hoomd/ExecutionConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,6 @@ ExecutionConfiguration::ExecutionConfiguration(executionMode mode,
}
#endif

#ifdef ENABLE_TBB
unsigned int num_threads = std::thread::hardware_concurrency();

char* env;
if ((env = getenv("OMP_NUM_THREADS")) != NULL)
{
num_threads = atoi(env);
msg->notice(2) << "Setting number of TBB threads to value of OMP_NUM_THREADS="
<< num_threads << std::endl;
}

setNumThreads(num_threads);
#endif

#if defined(ENABLE_HIP)
// setup synchronization events
m_events.resize(m_gpu_id.size());
Expand Down Expand Up @@ -697,10 +683,6 @@ void export_ExecutionConfiguration(pybind11::module& m)
.def("getPartition", &ExecutionConfiguration::getPartition)
.def("getNRanks", &ExecutionConfiguration::getNRanks)
.def("getRank", &ExecutionConfiguration::getRank)
#ifdef ENABLE_TBB
.def("setNumThreads", &ExecutionConfiguration::setNumThreads)
#endif
.def("getNumThreads", &ExecutionConfiguration::getNumThreads)
.def("setMemoryTracing", &ExecutionConfiguration::setMemoryTracing)
.def("memoryTracingEnabled", &ExecutionConfiguration::memoryTracingEnabled)
.def_static("getCapableDevices", &ExecutionConfiguration::getCapableDevices)
Expand Down
35 changes: 0 additions & 35 deletions hoomd/ExecutionConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
#endif
#endif

#ifdef ENABLE_TBB
#include <tbb/task_arena.h>
#endif

#include "Messenger.h"

/*! \file ExecutionConfiguration.h
Expand Down Expand Up @@ -254,32 +250,6 @@ class PYBIND11_EXPORT ExecutionConfiguration
return m_mpi_config->isRoot();
}

#ifdef ENABLE_TBB
//! set number of TBB threads
void setNumThreads(unsigned int num_threads)
{
m_task_arena = std::make_shared<tbb::task_arena>(num_threads);
m_num_threads = num_threads;
}

std::shared_ptr<tbb::task_arena> getTaskArena() const
{
if (!m_task_arena)
throw std::runtime_error("TBB task arena not set.");
return m_task_arena;
}
#endif

//! Return the number of active threads
unsigned int getNumThreads() const
{
#ifdef ENABLE_TBB
return m_num_threads;
#else
return 0;
#endif
}

#if defined(ENABLE_HIP)
//! Returns the cached allocator for temporary allocations
CachedAllocator& getCachedAllocator() const
Expand Down Expand Up @@ -401,11 +371,6 @@ class PYBIND11_EXPORT ExecutionConfiguration
m_cached_alloc_managed; //!< Cached allocator for temporary allocations in managed memory
#endif

#ifdef ENABLE_TBB
std::shared_ptr<tbb::task_arena> m_task_arena; //!< The TBB task arena
unsigned int m_num_threads; //!< The number of TBB threads used
#endif

//! Setup and print out stats on the chosen CPUs/GPUs
void setupStats();

Expand Down
72 changes: 0 additions & 72 deletions hoomd/HOOMDMPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@
#include <cereal/types/utility.hpp> // std::pair
#include <cereal/types/vector.hpp>

#ifdef ENABLE_TBB
// https://www.threadingbuildingblocks.org/docs/help/reference/appendices/known_issues/linux_os.html
#include <tbb/concurrent_unordered_map.h>
#include <tbb/concurrent_unordered_set.h>
#include <tbb/concurrent_vector.h>
#endif

namespace cereal
{
//! Serialization functions for some of our data types
Expand Down Expand Up @@ -110,71 +103,6 @@ void serialize(Archive& ar, hoomd::quat<Real>& q, const unsigned int version)
ar & q.v;
}

#ifdef ENABLE_TBB
//! Serialization for tbb::concurrent_vector
template<class Archive, class T, class A>
inline void save(Archive& ar, tbb::concurrent_vector<T, A> const& vector)
{
ar(make_size_tag(static_cast<size_type>(vector.size()))); // number of elements
for (auto&& v : vector)
ar(v);
}

template<class Archive, class T, class A>
inline void load(Archive& ar, tbb::concurrent_vector<T, A>& vector)
{
size_type size;
ar(make_size_tag(size));

vector.resize(static_cast<std::size_t>(size));
for (auto&& v : vector)
ar(v);
}

//! Serialization of tbb::concurrent_unordered_set
namespace tbb_unordered_set_detail
{
//! @internal
template<class Archive, class SetT> inline void save(Archive& ar, SetT const& set)
{
ar(make_size_tag(static_cast<size_type>(set.size())));

for (const auto& i : set)
ar(i);
}

//! @internal
template<class Archive, class SetT> inline void load(Archive& ar, SetT& set)
{
size_type size;
ar(make_size_tag(size));

set.clear();

for (size_type i = 0; i < size; ++i)
{
typename SetT::key_type key;

ar(key);
set.emplace(std::move(key));
}
}
} // namespace tbb_unordered_set_detail

//! Saving for tbb::concurrent_unordered_set
template<class Archive, class K, class H, class KE, class A>
inline void save(Archive& ar, tbb::concurrent_unordered_set<K, H, KE, A> const& unordered_set)
{
tbb_unordered_set_detail::save(ar, unordered_set);
}

//! Loading for tbb::concurrent_unordered_set
template<class Archive, class K, class H, class KE, class A>
inline void load(Archive& ar, tbb::concurrent_unordered_set<K, H, KE, A>& unordered_set)
{
tbb_unordered_set_detail::load(ar, unordered_set);
}
#endif
} // namespace cereal

namespace hoomd
Expand Down
Loading
Loading