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

Added Intel ThreadBuildingBlocks #1315

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
path = libraries/fc
url = https://github.com/bitshares/bitshares-fc.git
ignore = dirty
[submodule "libraries/tbb"]
path = libraries/tbb
url = https://github.com/wjakob/tbb
1 change: 1 addition & 0 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ add_subdirectory( utilities )
add_subdirectory( app )
add_subdirectory( plugins )
add_subdirectory( wallet )
add_subdirectory( tbb )
2 changes: 1 addition & 1 deletion libraries/egenesis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_executable( embed_genesis
embed_genesis.cpp
)

target_link_libraries( embed_genesis graphene_chain graphene_app graphene_egenesis_none fc )
target_link_libraries( embed_genesis graphene_chain graphene_app graphene_egenesis_none graphene_net fc tbb_static )

set( embed_genesis_args
-t "${CMAKE_CURRENT_SOURCE_DIR}/egenesis_brief.cpp.tmpl---${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp"
Expand Down
2 changes: 1 addition & 1 deletion libraries/net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ target_link_libraries( graphene_net
PUBLIC fc graphene_db )
target_include_directories( graphene_net
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
PRIVATE "${CMAKE_SOURCE_DIR}/libraries/chain/include"
PRIVATE "${CMAKE_SOURCE_DIR}/libraries/chain/include" "${CMAKE_SOURCE_DIR}/libraries/tbb/include"
)

if(MSVC)
Expand Down
8 changes: 4 additions & 4 deletions libraries/net/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,7 @@ namespace graphene { namespace net { namespace detail {
_terminating_connections.erase(originating_peer_ptr);
if (_active_connections.find(originating_peer_ptr) != _active_connections.end())
{
_active_connections.erase(originating_peer_ptr);
_active_connections.unsafe_erase(originating_peer_ptr);

if (inbound_endpoint && originating_peer_ptr->get_remote_endpoint())
{
Expand Down Expand Up @@ -3896,7 +3896,7 @@ namespace graphene { namespace net { namespace detail {
_handshaking_connections.erase(new_peer);
_terminating_connections.erase(new_peer);
assert(_active_connections.find(new_peer) == _active_connections.end());
_active_connections.erase(new_peer);
_active_connections.unsafe_erase(new_peer);
assert(_closing_connections.find(new_peer) == _closing_connections.end());
_closing_connections.erase(new_peer);

Expand Down Expand Up @@ -4212,7 +4212,7 @@ namespace graphene { namespace net { namespace detail {
void node_impl::move_peer_to_closing_list(const peer_connection_ptr& peer)
{
VERIFY_CORRECT_THREAD();
_active_connections.erase(peer);
_active_connections.unsafe_erase(peer);
_handshaking_connections.erase(peer);
_closing_connections.insert(peer);
_terminating_connections.erase(peer);
Expand All @@ -4221,7 +4221,7 @@ namespace graphene { namespace net { namespace detail {
void node_impl::move_peer_to_terminating_list(const peer_connection_ptr& peer)
{
VERIFY_CORRECT_THREAD();
_active_connections.erase(peer);
_active_connections.unsafe_erase(peer);
_handshaking_connections.erase(peer);
_closing_connections.erase(peer);
_terminating_connections.insert(peer);
Expand Down
3 changes: 2 additions & 1 deletion libraries/net/node_impl.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <memory>
#include <tbb/concurrent_unordered_set.h>
#include <fc/thread/thread.hpp>
#include <fc/log/logger.hpp>
#include <fc/network/tcp_socket.hpp>
Expand Down Expand Up @@ -274,7 +275,7 @@ class node_impl : public peer_connection_delegate
* back and forth (not yet ready to initiate syncing) */
std::unordered_set<graphene::net::peer_connection_ptr> _handshaking_connections;
/** stores fully established connections we're either syncing with or in normal operation with */
std::unordered_set<graphene::net::peer_connection_ptr> _active_connections;
tbb::concurrent_unordered_set<graphene::net::peer_connection_ptr, std::hash<graphene::net::peer_connection_ptr> > _active_connections;
/** stores connections we've closed (sent closing message, not actually closed), but are still waiting for the remote end to close before we delete them */
std::unordered_set<graphene::net::peer_connection_ptr> _closing_connections;
/** stores connections we've closed, but are still waiting for the OS to notify us that the socket is really closed */
Expand Down
1 change: 1 addition & 0 deletions libraries/tbb
Submodule tbb added at 08b434
4 changes: 3 additions & 1 deletion programs/delayed_node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ if( GPERFTOOLS_FOUND )
endif()

target_link_libraries( delayed_node
PRIVATE graphene_app graphene_account_history graphene_market_history graphene_delayed_node graphene_chain graphene_egenesis_full fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
PRIVATE graphene_app graphene_account_history graphene_market_history
graphene_delayed_node graphene_chain graphene_egenesis_full graphene_net fc tbb_static
${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )

install( TARGETS
delayed_node
Expand Down
2 changes: 1 addition & 1 deletion programs/genesis_util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if( UNIX AND NOT APPLE )
endif()

target_link_libraries( genesis_update
PRIVATE graphene_app graphene_chain graphene_egenesis_none fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
PRIVATE graphene_app graphene_chain graphene_egenesis_none graphene_net fc tbb_static ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )

install( TARGETS
genesis_update
Expand Down
6 changes: 4 additions & 2 deletions programs/witness_node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ endif()

# We have to link against graphene_debug_witness because deficiency in our API infrastructure doesn't allow plugins to be fully abstracted #246
target_link_libraries( witness_node

PRIVATE graphene_app graphene_delayed_node graphene_account_history graphene_elasticsearch graphene_market_history graphene_grouped_orders graphene_witness graphene_chain graphene_debug_witness graphene_egenesis_full graphene_snapshot graphene_es_objects fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
PRIVATE graphene_app graphene_delayed_node graphene_account_history
graphene_elasticsearch graphene_market_history graphene_grouped_orders
graphene_witness graphene_chain graphene_debug_witness graphene_egenesis_full
graphene_snapshot graphene_es_objects graphene_net fc tbb_static ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )

install( TARGETS
witness_node
Expand Down
22 changes: 16 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,39 @@ endif()

file(GLOB UNIT_TESTS "tests/*.cpp")
add_executable( chain_test ${COMMON_SOURCES} ${UNIT_TESTS} )
target_link_libraries( chain_test graphene_chain graphene_app graphene_witness graphene_account_history graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc graphene_wallet ${PLATFORM_SPECIFIC_LIBS} )
target_link_libraries( chain_test graphene_chain graphene_app graphene_witness graphene_account_history
graphene_elasticsearch graphene_es_objects graphene_egenesis_none graphene_net fc tbb_static
graphene_wallet ${PLATFORM_SPECIFIC_LIBS} )
if(MSVC)
set_source_files_properties( tests/serialization_tests.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
endif(MSVC)

file(GLOB PERFORMANCE_TESTS "performance/*.cpp")
add_executable( performance_test ${COMMON_SOURCES} ${PERFORMANCE_TESTS} )
target_link_libraries( performance_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} )
target_link_libraries( performance_test graphene_chain graphene_app graphene_account_history
graphene_elasticsearch graphene_es_objects graphene_egenesis_none
graphene_net fc tbb_static ${PLATFORM_SPECIFIC_LIBS} )

file(GLOB BENCH_MARKS "benchmarks/*.cpp")
add_executable( chain_bench ${COMMON_SOURCES} ${BENCH_MARKS} )
target_link_libraries( chain_bench graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} )
target_link_libraries( chain_bench graphene_chain graphene_app graphene_account_history
graphene_elasticsearch graphene_es_objects graphene_egenesis_none
graphene_net fc tbb_static ${PLATFORM_SPECIFIC_LIBS} )

file(GLOB APP_SOURCES "app/*.cpp")
add_executable( app_test ${APP_SOURCES} )
target_link_libraries( app_test graphene_app graphene_account_history graphene_net graphene_witness graphene_chain graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} )
target_link_libraries( app_test graphene_app graphene_account_history graphene_net
graphene_witness graphene_chain graphene_egenesis_none fc tbb_static ${PLATFORM_SPECIFIC_LIBS} )

file(GLOB CLI_SOURCES "cli/*.cpp")
add_executable( cli_test ${CLI_SOURCES} )
target_link_libraries( cli_test graphene_app graphene_wallet graphene_witness graphene_account_history graphene_net graphene_chain graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} )
target_link_libraries( cli_test graphene_app graphene_wallet graphene_witness graphene_account_history
graphene_net graphene_chain graphene_egenesis_none fc tbb_static ${PLATFORM_SPECIFIC_LIBS} )

file(GLOB ES_SOURCES "elasticsearch/*.cpp")
add_executable( es_test ${COMMON_SOURCES} ${ES_SOURCES} )
target_link_libraries( es_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} )
target_link_libraries( es_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch
graphene_es_objects graphene_egenesis_none
graphene_net fc tbb_static ${PLATFORM_SPECIFIC_LIBS} )

add_subdirectory( generate_empty_blocks )
2 changes: 1 addition & 1 deletion tests/generate_empty_blocks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if( UNIX AND NOT APPLE )
endif()

target_link_libraries( generate_empty_blocks
PRIVATE graphene_app graphene_chain graphene_egenesis_none fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
PRIVATE graphene_app graphene_chain graphene_egenesis_none graphene_net fc tbb_static ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )

install( TARGETS
generate_empty_blocks
Expand Down