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

803 Conform to new checkpoint API, make required #804

Merged
merged 2 commits into from
May 11, 2020
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
14 changes: 5 additions & 9 deletions cmake/link_vt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,12 @@ function(link_target_with_vt)
endif()

if (NOT DEFINED ARG_LINK_CHECKPOINT AND ${ARG_DEFAULT_LINK_SET} OR ARG_LINK_CHECKPOINT)
if (${VT_HAS_SERIALIZATION_LIBRARY})
if (${ARG_DEBUG_LINK})
message(STATUS "link_target_with_vt: checkpoint=${ARG_LINK_CHECKPOINT}")
endif()
target_link_libraries(
${ARG_TARGET} PUBLIC ${ARG_BUILD_TYPE} ${CHECKPOINT_LIBRARY}
)
else()
message(FATAL_ERROR "Trying to link with nonexistent checkpoint library")
if (${ARG_DEBUG_LINK})
message(STATUS "link_target_with_vt: checkpoint=${ARG_LINK_CHECKPOINT}")
endif()
target_link_libraries(
${ARG_TARGET} PUBLIC ${ARG_BUILD_TYPE} ${CHECKPOINT_LIBRARY}
)
endif()

if (NOT DEFINED ARG_LINK_DETECTOR AND ${ARG_DEFAULT_LINK_SET} OR ARG_LINK_DETECTOR)
Expand Down
21 changes: 6 additions & 15 deletions cmake/load_local_packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@ endif()

if (EXISTS "${PROJECT_LIB_DIR}/checkpoint")
add_subdirectory(${PROJECT_LIB_DIR}/checkpoint)
set(VT_HAS_SERIALIZATION_LIBRARY 1)
set(CHECKPOINT_LIBRARY vt::lib::checkpoint)
else()
# optional directory for this package
optional_pkg_directory(checkpoint "Serialization/Checkpoint" 1)
# find the optional packages locally if identified
if (${checkpoint_DIR_FOUND})
find_package_local(checkpoint "${checkpoint_DIR}" checkpoint)
if(NOT projHasParent)
if (NOT ${checkpoint_FOUND})
message(FATAL_ERROR "Serialization/checkpoint library not found")
endif()
endif()
set(VT_HAS_SERIALIZATION_LIBRARY 1)
set(CHECKPOINT_LIBRARY vt::lib::checkpoint)
endif()
# require directories for these packages
require_pkg_directory(checkpoint "VT checkpoint library")
# find these required packages locally
find_package_local(checkpoint "${checkpoint_DIR}" checkpoint)
endif()

set(CHECKPOINT_LIBRARY vt::lib::checkpoint)
1 change: 1 addition & 0 deletions cmake/local_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ macro(find_package_local pkg_name pkg_directory pkg_other_name)
NO_CMAKE_BUILDS_PATH
NO_CMAKE_SYSTEM_PATH
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
NO_SYSTEM_ENVIRONMENT_PATH
QUIET
)

Expand Down
8 changes: 1 addition & 7 deletions cmake/vtConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ set (detector_DIR @detector_DIR@)
find_dependency(detector REQUIRED HINTS @detector_DIR@)

set (checkpoint_DIR @checkpoint_DIR@)
set (vt_has_checkpoint @checkpoint_DIR_FOUND@)
if (@VT_HAS_SERIALIZATION_LIBRARY@)
find_dependency(checkpoint REQUIRED HINTS @checkpoint_DIR@)
set(VT_HAS_CHECKPOINT "TRUE")
else()
set(VT_HAS_CHECKPOINT "FALSE")
endif()
find_dependency(checkpoint REQUIRED HINTS @checkpoint_DIR@)

set (VT_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
set (VT_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
Expand Down
2 changes: 0 additions & 2 deletions cmake_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
//@HEADER
*/

#define HAS_SERIALIZATION_LIBRARY @VT_HAS_SERIALIZATION_LIBRARY@

#cmakedefine01 cmake_config_debug_enabled
#define cmake_config_debug_modes @cmake_vt_debug_modes@
#define cmake_config_modes @cmake_vt_modes@
Expand Down
24 changes: 0 additions & 24 deletions src/vt/messaging/active.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,28 +295,6 @@ struct ActiveMessenger : runtime::component::PollableComponent<ActiveMessenger>
TagType tag
);

#if not HAS_SERIALIZATION_LIBRARY

// Without serialization, everything must use basic copy-able transmission.

template <
typename MessageT,
typename = void
>
inline ActiveMessenger::PendingSendType sendMsgImpl(
NodeType dest,
HandlerType han,
MsgSharedPtr<MessageT>& msg,
ByteType msg_size,
TagType tag
) {
return sendMsgCopyableImpl<MessageT>(dest, han, msg, msg_size, tag);
}

#endif // not HAS_SERIALIZATION_LIBRARY

#if HAS_SERIALIZATION_LIBRARY

// With serialization, the correct method is resolved via SFINAE.
// This also includes additional guards to detect ambiguity.

Expand Down Expand Up @@ -434,8 +412,6 @@ struct ActiveMessenger : runtime::component::PollableComponent<ActiveMessenger>
return sendMsgCopyableImpl<MessageT>(dest, han, msg, msg_size, tag);
}

#endif // HAS_SERIALIZATION_LIBRARY

/**
* \defgroup preregister Basic Active Message Send with Pre-Registered Handler
*
Expand Down
6 changes: 1 addition & 5 deletions src/vt/messaging/active.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ void ActiveMessenger::setTagMessage(MsgT* msg, TagType tag) {
envelopeSetTag(msg->env, tag);
}

#if HAS_SERIALIZATION_LIBRARY

template <typename MessageT>
ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSerializableImpl(
NodeType dest,
Expand All @@ -134,7 +132,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSerializableImpl(
// through use of a wrapped message which does not define serialization.
// (Although such probably represents an opportunity for additional cleanup.)
static_assert( // that a message is serializable.
::serdes::SerializableTraits<MessageT>::is_serializable,
::checkpoint::SerializableTraits<MessageT>::is_serializable,
"Message going through serialization must meet all requirements."
);

Expand All @@ -150,8 +148,6 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSerializableImpl(
}
}

#endif

template <typename MessageT>
ActiveMessenger::PendingSendType ActiveMessenger::sendMsgCopyableImpl(
NodeType dest,
Expand Down
15 changes: 6 additions & 9 deletions src/vt/messaging/message/message_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@

#include <type_traits>

#if HAS_SERIALIZATION_LIBRARY

// These should probably be .. elsewhere.
// They are lifted for demonstration purposes.
#define HAS_DETECTION_COMPONENT 1
#include "serialization_library_headers.h"
#include "traits/serializable_traits.h"
#include <checkpoint/checkpoint.h>

namespace vt { namespace messaging {

Expand All @@ -68,7 +64,10 @@ struct has_own_serialize_member_t : std::false_type {};
template <typename U>
struct has_own_serialize_member_t<U,
std::enable_if_t<
std::is_same<void (U::*)(::serdes::Sizer&), decltype(&U::template serialize<::serdes::Sizer&>)>::value
std::is_same<
void (U::*)(::checkpoint::Sizer&),
decltype(&U::template serialize<::checkpoint::Sizer&>)
>::value
>>
: std::true_type
{};
Expand All @@ -77,15 +76,13 @@ struct has_own_serialize_member_t<U,
// or a serialize member is declared on the precise type.
template <typename T>
static constexpr auto const has_own_serialize =
::serdes::SerializableTraits<T>::has_serialize_noninstrusive
::checkpoint::SerializableTraits<T>::has_serialize_noninstrusive
or has_own_serialize_member_t<T>::value;

#endif

}} // end vt::messaging

#endif

/** \file */

// These macros are always available, regardless of serialization support.
Expand Down
6 changes: 2 additions & 4 deletions src/vt/messaging/message/shared_message.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@
#include "vt/messaging/message/smart_ptr.h"
#include "vt/pool/pool.h"

#if HAS_SERIALIZATION_LIBRARY
#include "serialization_library_headers.h"
#endif
#include <checkpoint/checkpoint.h>

namespace vt {

template <typename MsgT>
void messageTypeChecks() {
static_assert(
std::is_trivially_destructible<MsgT>::value or
serdes::SerializableTraits<MsgT>::has_serialize_function,
checkpoint::SerializableTraits<MsgT>::has_serialize_function,
"All messages must either be trivially destructible or "
"have a valid serialization function associated with them"
);
Expand Down
106 changes: 0 additions & 106 deletions src/vt/serialization/auto_sizing/sizing.h

This file was deleted.

5 changes: 2 additions & 3 deletions src/vt/serialization/messaging/serialized_data_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@

#include "vt/config.h"
#include "vt/messaging/message.h"
#include "vt/serialization/serialization.h"

using namespace ::serialization::interface;

namespace vt { namespace serialization {

using SizeType = std::size_t;

static constexpr SizeType const serialized_msg_eager_size = 128;

struct NoneVrt { };
Expand Down
2 changes: 0 additions & 2 deletions src/vt/serialization/messaging/serialized_messenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
#include <cstdlib>
#include <functional>

using namespace ::serialization::interface;

namespace vt { namespace serialization {

template <typename MsgT, typename BaseEagerMsgT>
Expand Down
Loading