Skip to content

Commit

Permalink
Merge pull request #506 from DARMA-tasking/1.0.0-beta.1-proposed-update
Browse files Browse the repository at this point in the history
1.0.0 beta.1 proposed update
  • Loading branch information
lifflander authored Oct 17, 2019
2 parents 013ecdd + 63c4ad6 commit 107a7cd
Show file tree
Hide file tree
Showing 34 changed files with 142 additions and 79 deletions.
8 changes: 4 additions & 4 deletions examples/broadcast_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ using namespace vt;

static constexpr int32_t const num_bcasts = 4;
static NodeType my_node = uninitialized_destination;
static int32_t count = 0;
static int32_t bcast_count = 0;

struct Msg : vt::Message {
NodeType broot;
Expand All @@ -70,7 +70,7 @@ static void bcastTest(Msg* msg) {
root != my_node, "Broadcast should deliver to all but this node"
);

count++;
bcast_count++;
}

int main(int argc, char** argv) {
Expand All @@ -96,8 +96,8 @@ int main(int argc, char** argv) {
));

theTerm()->addAction([=]{
fmt::print("[{}] verify: count={}, expected={}\n", my_node, count, expected);
vtAssertExpr(count == expected);
fmt::print("[{}] verify: bcast_count={}, expected={}\n", my_node, bcast_count, expected);
vtAssertExpr(bcast_count == expected);
});

if (from_node == uninitialized_destination or from_node == my_node) {
Expand Down
27 changes: 16 additions & 11 deletions src/vt/configs/arguments/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

namespace vt { namespace arguments {

/*static*/ CLI::App ArgConfig::app{"vt"};
/*static*/ bool ArgConfig::vt_color = true;
/*static*/ bool ArgConfig::vt_no_color = false;
/*static*/ bool ArgConfig::vt_auto_color = false;
Expand Down Expand Up @@ -138,12 +137,15 @@ namespace vt { namespace arguments {
/*static*/ bool ArgConfig::parsed = false;

/*static*/ int ArgConfig::parse(int& argc, char**& argv) {
static CLI::App app{"vt"};

if (parsed || argc == 0 || argv == nullptr) {
return 0;
}

// CLI11 app parser expects to get the arguments in *reverse* order!
std::vector<std::string> args;
for (auto i = 0; i < argc; i++) {
for (auto i = argc-1; i > 0; i--) {
args.push_back(std::string(argv[i]));
}

Expand Down Expand Up @@ -450,23 +452,26 @@ namespace vt { namespace arguments {
*/
std::vector<std::string> ret_args;
std::vector<std::size_t> ret_idx;
int item = 0;

// Reverse iterate (CLI11 reverses the order when they modify the args)
for (auto iter = args.rbegin(); iter != args.rend(); ++iter) {
for (auto ii = 0; ii < argc; ii++) {
if (std::string(argv[ii]) == *iter) {
// Iterate forward (CLI11 reverses the order when it modifies the args)
for (auto&& skipped : args) {
for (auto ii = item; ii < argc; ii++) {
if (std::string(argv[ii]) == skipped) {
ret_idx.push_back(ii);
item++;
break;
}
}
ret_args.push_back(*iter);
ret_args.push_back(skipped);
}

// Use the saved index to setup the new_argv and new_argc
int new_argc = ret_args.size();
char** new_argv = new char*[new_argc];
for (auto ii = 0; ii < new_argc; ii++) {
new_argv[ii] = argv[ret_idx[ii]];
int new_argc = ret_args.size() + 1;
char** new_argv = new char*[new_argc + 1];
new_argv[0] = argv[0];
for (auto ii = 1; ii < new_argc; ii++) {
new_argv[ii] = argv[ret_idx[ii - 1]];
}

// Set them back with all vt arguments elided
Expand Down
3 changes: 1 addition & 2 deletions src/vt/configs/arguments/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "vt/config.h"

#include "CLI/CLI11.hpp"
#include <string>

namespace vt { namespace arguments {

Expand Down Expand Up @@ -139,7 +139,6 @@ struct ArgConfig {
static std::string vt_user_str_3;

private:
static CLI::App app;
static bool parsed;
};

Expand Down
2 changes: 2 additions & 0 deletions src/vt/group/group_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ struct Info : InfoRooted, InfoColl {
bool const in_is_in_group, bool make_mpi_group
);

virtual ~Info() {}

friend struct GroupManager;

template <typename MsgT>
Expand Down
4 changes: 3 additions & 1 deletion src/vt/group/region/group_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ struct Range : Region {

Range(Range const&) = default;
Range(Range&&) = default;
Range& operator=(Range const&) = default;

// Cannot copy const members
Range& operator=(Range const&) = delete;

virtual SizeType getSize() const override;
virtual void sort() override;
Expand Down
2 changes: 2 additions & 0 deletions src/vt/messaging/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
namespace vt { namespace messaging {

struct Listener {
virtual ~Listener() {}

virtual void send(NodeType dest, MsgSizeType size, bool bcast) = 0;
};

Expand Down
5 changes: 2 additions & 3 deletions src/vt/rdma/rdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace vt { namespace rdma {
theRDMA()->requestGetData(
msg, msg->is_user_msg, msg->rdma_handle, msg_tag, msg->num_bytes,
msg->offset, false, nullptr, recv_node,
[msg_tag,op_id,recv_node,handle](RDMA_GetType data){
[op_id,recv_node,handle](RDMA_GetType data){
auto const& my_node = theContext()->getNode();
debug_print(
rdma, node, "data is ready\n"
Expand Down Expand Up @@ -110,7 +110,6 @@ namespace vt { namespace rdma {
auto get_ptr = std::get<0>(direct);
auto get_ptr_action = std::get<1>(direct);

auto const& this_node = theContext()->getNode();
debug_print(
rdma, node,
"getRecvMsg: op={}, tag={}, bytes={}, get_ptr={}, "
Expand All @@ -130,7 +129,7 @@ namespace vt { namespace rdma {
);
} else {
theMsg()->recvDataMsgBuffer(
get_ptr, msg->mpi_tag_to_recv, msg->send_back, true, [this_node,get_ptr_action]{
get_ptr, msg->mpi_tag_to_recv, msg->send_back, true, [get_ptr_action]{
debug_print(
rdma, node,
"recv_data_msg_buffer finished\n"
Expand Down
1 change: 1 addition & 0 deletions src/vt/registry/auto/auto_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ trace::TraceEntryIDType theTraceID(
}
default:
assert(0 && "Should not be reachable");
return trace::TraceEntryIDType{};
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vt/runtime/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void Runtime::printStartupBanner() {
auto f9 = opt_on("--vt_trace", "Tracing enabled");
fmt::print("{}\t{}{}", vt_pre, f9, reset);
if (ArgType::vt_trace_file != "") {
auto f11 = fmt::format("Trace file name \"{}\"", theTrace->getTraceName());
auto f11 = fmt::format("Trace file name \"{}\"", ArgType::vt_trace_file);
auto f12 = opt_on("--vt_trace_file", f11);
fmt::print("{}\t{}{}", vt_pre, f12, reset);
} else {
Expand Down
1 change: 1 addition & 0 deletions src/vt/sequence/sequencer.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct TaggedSequencer {
static std::unique_ptr<SeqManagerType> seq_manager;

TaggedSequencer() = default;
virtual ~TaggedSequencer() {}

// Get the correct ID based on the type
virtual SeqType getNextID();
Expand Down
24 changes: 20 additions & 4 deletions src/vt/serialization/messaging/serialized_messenger.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,26 @@ template <typename UserMsgT>
) {
auto const handler = sys_msg->handler;
auto const& recv_tag = sys_msg->data_recv_tag;
auto const epoch = envelopeGetEpoch(sys_msg->env);

debug_print(
serial_msg, node,
"serialMsgHandler: non-eager, recvDataMsg: msg={}, handler={}, "
"recv_tag={}, epoch={}\n",
print_ptr(sys_msg), handler, recv_tag, envelopeGetEpoch(sys_msg->env)
print_ptr(sys_msg), handler, recv_tag, epoch
);

bool const is_valid_epoch = epoch != no_epoch;

if (is_valid_epoch) {
theTerm()->produce(epoch);
}

auto node = sys_msg->from_node;
theMsg()->recvDataMsg(
recv_tag, sys_msg->from_node,
[handler,recv_tag,node](RDMA_GetType ptr, ActionType action){
[handler,recv_tag,node,epoch,is_valid_epoch]
(RDMA_GetType ptr, ActionType action){
// be careful here not to use "msg", it is no longer valid
auto raw_ptr = reinterpret_cast<SerialByteType*>(std::get<0>(ptr));
auto ptr_size = std::get<1>(ptr);
Expand All @@ -136,8 +144,16 @@ template <typename UserMsgT>
handler, recv_tag, envelopeGetEpoch(msg->env)
);

if (is_valid_epoch) {
theMsg()->pushEpoch(epoch);
}
runnable::Runnable<UserMsgT>::run(handler, nullptr, msg.get(), node);
action();

if (is_valid_epoch) {
theMsg()->popEpoch(epoch);
theTerm()->consume(epoch);
}
}
);
}
Expand Down Expand Up @@ -483,8 +499,8 @@ template <typename MsgT, typename BaseT>
auto sys_msg = makeMessage<SerialWrapperMsgType<MsgT>>();
auto send_serialized = [=](Active::SendFnType send){
auto ret = send(RDMA_GetType{ptr, ptr_size}, dest, no_tag);
EventType event = std::get<0>(ret);
theEvent()->attachAction(event, [=]{ std::free(ptr); });
EventType event = std::get<0>(ret);
theEvent()->attachAction(event, [=]{ std::free(ptr); });
sys_msg->data_recv_tag = std::get<1>(ret);
};
auto cur_ref = envelopeGetRef(sys_msg->env);
Expand Down
1 change: 1 addition & 0 deletions src/vt/termination/termination.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct TerminationDetector :
using ParentBagType = EpochRelation::ParentBagType;

TerminationDetector();
virtual ~TerminationDetector() {}

/****************************************************************************
*
Expand Down
25 changes: 17 additions & 8 deletions src/vt/trace/trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,30 @@ void Trace::setupNames(

prog_name_ = in_prog_name;
trace_name_ = in_trace_name;
dir_name_ = in_dir_name;
start_time_ = getCurrentTime();

std::string dir_name = (in_dir_name.empty()) ? prog_name_ + "_trace" : in_dir_name;

char cur_dir[1024];
if (getcwd(cur_dir, sizeof(cur_dir)) == nullptr) {
vtAssert(false, "Must have current directory");
}

if (ArgType::vt_trace_dir != "") {
full_dir_name = std::string(cur_dir) + "/" + ArgType::vt_trace_dir + "/";
full_dir_name = ArgType::vt_trace_dir;
}
else {
full_dir_name = std::string(cur_dir) + "/" + dir_name;
}

if (full_dir_name[full_dir_name.size()-1] != '/')
full_dir_name = full_dir_name + "/";

if (theContext()->getNode() == 0) {
mkdir(full_dir_name.c_str(), S_IRWXU);
//vtAssert(dir_ret != -1, "Must be able to make directory");
int flag = mkdir(full_dir_name.c_str(), S_IRWXU);
if ((flag < 0) && (errno != EEXIST)) {
vtAssert(flag >= 0, "Must be able to make directory");
}
}

auto const tc = util::demangle::DemanglerUtils::splitString(trace_name_, '/');
Expand All @@ -118,11 +127,11 @@ void Trace::setupNames(

auto const node_str = "." + std::to_string(node) + ".log.gz";
if (ArgType::vt_trace_file != "") {
full_trace_name = full_dir_name + "/" + ArgType::vt_trace_file + node_str;
full_sts_name = full_dir_name + "/" + ArgType::vt_trace_file + ".sts";
full_trace_name = full_dir_name + ArgType::vt_trace_file + node_str;
full_sts_name = full_dir_name + ArgType::vt_trace_file + ".sts";
} else {
full_trace_name = full_dir_name + "/" + trace_name;
full_sts_name = full_dir_name + "/" + prog_name + ".sts";
full_trace_name = full_dir_name + trace_name;
full_sts_name = full_dir_name + prog_name + ".sts";
}
}

Expand Down
1 change: 0 additions & 1 deletion src/vt/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ struct Trace {
TraceContainerType traces_;
TraceStackType open_events_;
TraceEventIDType cur_event_ = 1;
std::string dir_name_ = "";
std::string prog_name_ = "";
std::string trace_name_ = "";
bool enabled_ = true;
Expand Down
7 changes: 6 additions & 1 deletion src/vt/vrt/collection/balance/gossiplb/gossiplb.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@
namespace vt { namespace vrt { namespace collection { namespace lb {

struct GossipLB : BaseLB {

public: // ctors
GossipLB() = default;

GossipLB(GossipLB const&) = delete;
GossipLB(GossipLB&&) = default;

virtual ~GossipLB() {}

public:
void init(objgroup::proxy::Proxy<GossipLB> in_proxy);
void runLB() override;

Expand Down
1 change: 1 addition & 0 deletions src/vt/vrt/collection/balance/greedylb/greedylb.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct GreedyLB : BaseLB {
using LoadProfileType = std::unordered_map<NodeType,LoadType>;

GreedyLB() = default;
virtual ~GreedyLB() {}

void init(objgroup::proxy::Proxy<GreedyLB> in_proxy);
void runLB() override;
Expand Down
1 change: 1 addition & 0 deletions src/vt/vrt/collection/balance/hierarchicallb/hierlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct HierarchicalLB : BaseLB {
using LoadType = double;

HierarchicalLB() = default;
virtual ~HierarchicalLB() {}

void init(objgroup::proxy::Proxy<HierarchicalLB> in_proxy);
void runLB() override;
Expand Down
16 changes: 1 addition & 15 deletions src/vt/vrt/collection/balance/lb_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ enum struct CommCategory : int8_t {
NodeToCollectionBcast = 6,
};

template <typename SerializerT, typename E>
void serializeEnum(SerializerT& s, E& e) {
using EnumDataType = typename std::underlying_type<E>::type;
auto val = static_cast<EnumDataType>(e);
s | val;
e = static_cast<CommCategory>(val);
}

template <typename SerializerT>
void serializeCommCategory(SerializerT& s, CommCategory& cat) {
serializeEnum<SerializerT, CommCategory>(s, cat);
}

inline NodeType objGetNode(ElementIDType const id) {
return id & 0x0000000FFFFFFFF;
}
Expand Down Expand Up @@ -150,8 +137,7 @@ struct LBCommKey {

template <typename SerializerT>
void serialize(SerializerT& s) {
s | from_ | to_ | from_temp_ | to_temp_ | nfrom_ | nto_;
serializeCommCategory(s, cat_);
s | from_ | to_ | from_temp_ | to_temp_ | nfrom_ | nto_ | cat_;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/balance/lb_invoke/invoke.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ LBManager::makeLB(MsgSharedPtr<StartLBMsg> msg) {
auto proxy = theObjGroup()->makeCollective<LB>();
proxy.get()->init(proxy);
auto base_proxy = proxy.template registerBaseCollective<lb::BaseLB>();
proxy.get()->template startLBHandler(msg.get(), base_proxy);
proxy.get()->startLBHandler(msg.get(), base_proxy);
destroy_lb_ = [proxy]{ proxy.destroyCollective(); };
return proxy;
}
Expand Down
1 change: 1 addition & 0 deletions src/vt/vrt/collection/balance/lb_invoke/invoke.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct LBManager {
LBManager() = default;
LBManager(LBManager const&) = delete;
LBManager(LBManager&&) = default;
virtual ~LBManager() {}

static void init() {
LBManager::proxy_ = theObjGroup()->makeCollective<LBManager>();
Expand Down
1 change: 1 addition & 0 deletions src/vt/vrt/collection/balance/proc_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include <string>
#include <cstdio>
#include <unistd.h>
#include <sys/stat.h>

#include "fmt/format.h"

Expand Down
Loading

0 comments on commit 107a7cd

Please sign in to comment.