Skip to content

Commit

Permalink
Merge pull request #2419 from STEllAR-GROUP/verbs_rebased
Browse files Browse the repository at this point in the history
Infiniband parcelport
  • Loading branch information
hkaiser committed Jan 17, 2017
2 parents f6b6155 + 70f6406 commit 0cb47e2
Show file tree
Hide file tree
Showing 48 changed files with 9,354 additions and 319 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Expand Up @@ -559,6 +559,9 @@ if(HPX_WITH_PARCEL_PROFILING)
endif()

## Parcelport related build options
hpx_option(HPX_WITH_PARCELPORT_VERBS BOOL
"Enable the ibverbs based parcelport. This is currently an experimental feature"
OFF CATEGORY "Parcelport" ADVANCED)
hpx_option(HPX_WITH_PARCELPORT_MPI BOOL
"Enable the MPI based parcelport."
OFF CATEGORY "Parcelport")
Expand Down Expand Up @@ -1114,7 +1117,9 @@ if(WIN32)
##############################################################################

hpx_add_config_define(BOOST_USE_WINDOWS_H)
hpx_add_config_define(BOOST_SERIALIZATION_DYN_LINK)
if (NOT Boost_USE_STATIC_LIBS)
hpx_add_config_define(BOOST_SERIALIZATION_DYN_LINK)
endif()
if(NOT CMAKE_CL_64)
hpx_add_config_define(BOOST_NO_ALIGNMENT)
endif()
Expand Down
27 changes: 27 additions & 0 deletions cmake/FindIB_VERBS.cmake
@@ -0,0 +1,27 @@
# Copyright (c) 2014 John Biddiscombe
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

# - Try to find IB Verbs
# Once done this will define
# IB_VERBS_FOUND - System has IB Verbs
# IB_VERBS_INCLUDE_DIRS - The IB Verbs include directories
# IB_VERBS_LIBRARIES - The libraries needed to use IB Verbs

find_path(IB_VERBS_INCLUDE_DIR verbs.h
HINTS /usr/local/include /usr/include/infiniband)

find_library(IB_VERBS_LIBRARY NAMES ibverbs
PATHS /usr/local/lib /usr/lib)

set(IB_VERBS_INCLUDE_DIRS ${IB_VERBS_INCLUDE_DIR})
set(IB_VERBS_LIBRARIES ${IB_VERBS_LIBRARY})

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set IB_VERBS_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(IB_VERBS DEFAULT_MSG
IB_VERBS_INCLUDE_DIR IB_VERBS_LIBRARY)

mark_as_advanced(IB_VERBS_INCLUDE_DIR IB_VERBS_LIBRARY)
27 changes: 27 additions & 0 deletions cmake/FindRDMA_CM.cmake
@@ -0,0 +1,27 @@
# Copyright (c) 2014 John Biddiscombe
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# - Try to find RDMA CM
# Once done this will define
# RDMA_CM_FOUND - System has RDMA CM
# RDMA_CM_INCLUDE_DIRS - The RDMA CM include directories
# RDMA_CM_LIBRARIES - The libraries needed to use RDMA CM

find_path(RDMA_CM_INCLUDE_DIR rdma_cma.h
HINTS /usr/local/include /usr/include/rdma)

find_library(RDMA_CM_LIBRARY NAMES rdmacm
PATHS /usr/local/lib /usr/lib)

set(RDMA_CM_INCLUDE_DIRS ${RDMA_CM_INCLUDE_DIR})
set(RDMA_CM_LIBRARIES ${RDMA_CM_LIBRARY})

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set RDMA_CM_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(RDMA_CM DEFAULT_MSG
RDMA_CM_INCLUDE_DIR RDMA_CM_LIBRARY)

mark_as_advanced(RDMA_CM_INCLUDE_DIR RDMA_CM_LIBRARY)
8 changes: 4 additions & 4 deletions cmake/HPX_AddTest.cmake
Expand Up @@ -52,11 +52,11 @@ macro(add_hpx_test category name)
NAME "${category}.${name}"
COMMAND ${cmd} ${args})
else()
if(HPX_WITH_PARCELPORT_IBVERBS)
if(HPX_WITH_PARCELPORT_VERBS)
set(_add_test FALSE)
if(DEFINED ${name}_PARCELPORTS)
set(PP_FOUND -1)
list(FIND ${name}_PARCELPORTS "ibverbs" PP_FOUND)
list(FIND ${name}_PARCELPORTS "verbs" PP_FOUND)
if(NOT PP_FOUND EQUAL -1)
set(_add_test TRUE)
endif()
Expand All @@ -65,8 +65,8 @@ macro(add_hpx_test category name)
endif()
if(_add_test)
add_test(
NAME "${category}.distributed.ibverbs.${name}"
COMMAND ${cmd} "-p" "ibverbs" ${args})
NAME "${category}.distributed.verbs.${name}"
COMMAND ${cmd} "-p" "verbs" ${args})
endif()
endif()
if(HPX_WITH_PARCELPORT_IPC)
Expand Down
6 changes: 6 additions & 0 deletions cmake/HPX_SetupBoost.cmake
Expand Up @@ -21,6 +21,11 @@ set(Boost_ADDITIONAL_VERSIONS
"1.58.0" "1.58"
"1.57.0" "1.57")

set(HPX_BOOST_LOG_LIBS "")
if(HPX_PARCELPORT_VERBS_WITH_LOGGING OR HPX_PARCELPORT_VERBS_WITH_DEV_MODE)
set(HPX_BOOST_LOG_LIBS log log_setup)
endif()

find_package(Boost
1.50
REQUIRED
Expand All @@ -32,6 +37,7 @@ find_package(Boost
regex
system
thread
${HPX_BOOST_LOG_LIBS}
)

if(NOT Boost_FOUND)
Expand Down
6 changes: 3 additions & 3 deletions cmake/templates/hpxrun.py.in
Expand Up @@ -99,7 +99,7 @@ def build_cmd(options, args):
if options.localities > 1:
# Selecting the parcelport for hpx via hpx ini confifuration
select_parcelport = (lambda pp:
['-Ihpx.parcel.ibverbs.enable=1'] if pp == 'ibverbs'
['-Ihpx.parcel.verbs.enable=1'] if pp == 'verbs'
else ['-Ihpx.parcel.ipc.enable=1'] if pp == 'ipc'
else ['-Ihpx.parcel.mpi.enable=1', '-Ihpx.parcel.bootstrap=mpi'] if pp == 'mpi'
else ['-Ihpx.parcel.tcp.enable=1'] if pp == 'tcp'
Expand Down Expand Up @@ -140,7 +140,7 @@ def check_options(parser, options, args):
sys.exit(1)

check_valid_parcelport = (lambda x:
x == 'ibverbs' or x == 'ipc' or x == 'mpi' or x == 'tcp');
x == 'verbs' or x == 'ipc' or x == 'mpi' or x == 'tcp');
if not check_valid_parcelport(options.parcelport):
print('Error: Parcelport option not valid\n', sys.stderr)
parser.print_help()
Expand Down Expand Up @@ -203,7 +203,7 @@ if __name__ == '__main__':
parser.add_option('-p', '--parcelport'
, action='store', type='string'
, dest='parcelport', default=default_env('HPXRUN_PARCELPORT', 'tcp')
, help='Which parcelport to use (Options are: ibverbs, ipc, mpi, tcp) '
, help='Which parcelport to use (Options are: verbs, ipc, mpi, tcp) '
'(environment variable HPXRUN_PARCELPORT')

parser.add_option('-r', '--runwrapper'
Expand Down
17 changes: 14 additions & 3 deletions hpx/runtime/parcelset/parcel_buffer.hpp
Expand Up @@ -32,21 +32,28 @@ namespace hpx { namespace parcelset
explicit parcel_buffer(allocator_type allocator = allocator_type())
: data_(allocator)
, num_chunks_(count_chunks_type(0, 0))
, size_(0), data_size_(0)
, size_(0), data_size_(0), header_size_(0)
{}

explicit parcel_buffer(BufferType const & data,
allocator_type allocator = allocator_type())
: data_(data, allocator)
, num_chunks_(count_chunks_type(0, 0))
, size_(0), data_size_(0)
, size_(0), data_size_(0), header_size_(0)
{}

explicit parcel_buffer(BufferType && data,
allocator_type allocator = allocator_type())
: data_(std::move(data), allocator)
, num_chunks_(count_chunks_type(0, 0))
, size_(0), data_size_(0)
, size_(0), data_size_(0), header_size_(0)
{}

explicit parcel_buffer(BufferType && data,
allocator_type *allocator)
: data_(std::move(data))
, num_chunks_(count_chunks_type(0, 0))
, size_(0), data_size_(0), header_size_(0)
{}

parcel_buffer(parcel_buffer && other)
Expand All @@ -56,6 +63,7 @@ namespace hpx { namespace parcelset
, num_chunks_(other.num_chunks_)
, size_(other.size_)
, data_size_(other.data_size_)
, header_size_(other.header_size_)
, data_point_(other.data_point_)
{
}
Expand All @@ -68,6 +76,7 @@ namespace hpx { namespace parcelset
num_chunks_ = other.num_chunks_;
size_ = other.size_;
data_size_ = other.data_size_;
header_size_ = other.header_size_;
data_point_ = other.data_point_;

return *this;
Expand All @@ -81,6 +90,7 @@ namespace hpx { namespace parcelset
num_chunks_ = count_chunks_type(0, 0);
size_ = 0;
data_size_ = 0;
header_size_ = 0;
data_point_ = performance_counters::parcels::data_point();
}

Expand All @@ -97,6 +107,7 @@ namespace hpx { namespace parcelset

util::integer::ulittle64_t size_;
util::integer::ulittle64_t data_size_;
util::integer::ulittle64_t header_size_;

/// Counters and their data containers.
performance_counters::parcels::data_point data_point_;
Expand Down
18 changes: 14 additions & 4 deletions hpx/runtime/parcelset/parcelport_connection.hpp
Expand Up @@ -11,6 +11,7 @@

#include <cstdint>
#include <memory>
#include <utility>

namespace hpx { namespace parcelset {

Expand All @@ -25,6 +26,10 @@ namespace hpx { namespace parcelset {
struct parcelport_connection
: std::enable_shared_from_this<Connection>
{
////////////////////////////////////////////////////////////////////////
typedef BufferType buffer_type;
typedef parcel_buffer<buffer_type, ChunkType> parcel_buffer_type;

private:
HPX_NON_COPYABLE(parcelport_connection);

Expand Down Expand Up @@ -92,6 +97,15 @@ namespace hpx { namespace parcelset {
parcelport_connection(typename BufferType::allocator_type const & alloc)
: buffer_(alloc)
{}

parcelport_connection(typename BufferType::allocator_type * alloc)
: buffer_(std::move(buffer_type(alloc)),alloc)
{}

parcelport_connection(parcel_buffer_type && buffer)
: buffer_(std::move(buffer))
{}

#endif

#if defined(HPX_TRACK_STATE_OF_OUTGOING_TCP_CONNECTION)
Expand All @@ -103,10 +117,6 @@ namespace hpx { namespace parcelset {

virtual ~parcelport_connection() {}

////////////////////////////////////////////////////////////////////////
typedef BufferType buffer_type;
typedef parcel_buffer<buffer_type, ChunkType> parcel_buffer_type;

/// buffer for data
parcel_buffer_type buffer_;
};
Expand Down
6 changes: 5 additions & 1 deletion hpx/runtime/parcelset/parcelport_impl.hpp
Expand Up @@ -339,7 +339,11 @@ namespace hpx { namespace parcelset

bool do_background_work(std::size_t num_thread)
{
trigger_pending_work();
if (!connection_handler_traits<ConnectionHandler>::
send_immediate_parcels::value)
{
trigger_pending_work();
}
return do_background_work_impl<ConnectionHandler>(num_thread);
}

Expand Down
15 changes: 8 additions & 7 deletions hpx/runtime/serialization/serialization_chunk.hpp
Expand Up @@ -40,26 +40,27 @@ namespace hpx { namespace serialization

struct serialization_chunk
{
chunk_data data_; // index or pointer
std::size_t size_;
// size of the serialization_chunk starting at index_/pos_
std::uint8_t type_; // chunk_type
chunk_data data_; // index or pointer
std::size_t size_; // size of the serialization_chunk starting index_/pos_
std::uint8_t type_; // chunk_type
std::uint32_t rkey_; // optional RDMA remote key for parcelport put/get operations
};

///////////////////////////////////////////////////////////////////////
inline serialization_chunk create_index_chunk(std::size_t index, std::size_t size)
{
serialization_chunk retval = {
{ 0 }, size, static_cast<std::uint8_t>(chunk_type_index)
{ 0 }, size, static_cast<std::uint8_t>(chunk_type_index), 0
};
retval.data_.index_ = index;
return retval;
}

inline serialization_chunk create_pointer_chunk(void const* pos, std::size_t size)
inline serialization_chunk create_pointer_chunk(void const* pos, std::size_t size,
std::uint32_t rkey=0)
{
serialization_chunk retval = {
{ 0 }, size, static_cast<std::uint8_t>(chunk_type_pointer)
{ 0 }, size, static_cast<std::uint8_t>(chunk_type_pointer), rkey
};
retval.data_.cpos_ = pos;
return retval;
Expand Down

0 comments on commit 0cb47e2

Please sign in to comment.