Skip to content

Commit

Permalink
Minor formatting fixes in the performance tests
Browse files Browse the repository at this point in the history
Applied clang-format to the performance tests and slightly improved the
readability of the usage messages. Also copied the new "proc_name"
option to signed_bw_test, so that it's consistent with the others.
  • Loading branch information
etremel committed Nov 18, 2020
1 parent 98db242 commit 9309e41
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 64 deletions.
19 changes: 9 additions & 10 deletions src/applications/tests/performance_tests/bandwidth_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* in the only subgroup that consists of all the nodes
* Upon completion, the results are appended to file data_derecho_bw on the leader
*/
#include <chrono>
#include <fstream>
#include <iostream>
#include <map>
#include <memory>
#include <optional>
#include <chrono>
#include <vector>

#include <derecho/core/derecho.hpp>
Expand Down Expand Up @@ -45,22 +45,21 @@ struct exp_result {
}
};

#define DEFAULT_PROC_NAME "bw_test"
#define DEFAULT_PROC_NAME "bw_test"

int main(int argc, char* argv[]) {

int dashdash_pos = argc - 1;
while (dashdash_pos > 0) {
if (strcmp(argv[dashdash_pos],"--") == 0) {
while(dashdash_pos > 0) {
if(strcmp(argv[dashdash_pos], "--") == 0) {
break;
}
dashdash_pos -- ;
dashdash_pos--;
}

if((argc-dashdash_pos) < 5) {
if((argc - dashdash_pos) < 5) {
cout << "Invalid command line arguments." << endl;
cout << "USAGE:" << argv[0] << "[ derecho-config-list ] -- num_nodes, sender_selector (0 - all senders, 1 - half senders, 2 - one sender), num_messages, delivery_mode (0 - ordered mode, 1 - unordered mode) [proc_name]" << endl;
cout << "Note:proc_name is for ps and pkill commands, default to " DEFAULT_PROC_NAME << endl;
cout << "USAGE: " << argv[0] << " [ derecho-config-list -- ] num_nodes, sender_selector (0 - all senders, 1 - half senders, 2 - one sender), num_messages, delivery_mode (0 - ordered mode, 1 - unordered mode) [proc_name]" << endl;
std::cout << "Note: proc_name sets the process's name as displayed in ps and pkill commands, default is " DEFAULT_PROC_NAME << std::endl;
return -1;
}

Expand All @@ -76,7 +75,7 @@ int main(int argc, char* argv[]) {
? PartialSendMode::HALF_SENDERS
: PartialSendMode::ONE_SENDER);

if (dashdash_pos + 5 < argc) {
if(dashdash_pos + 5 < argc) {
pthread_setname_np(pthread_self(), argv[dashdash_pos + 5]);
} else {
pthread_setname_np(pthread_self(), DEFAULT_PROC_NAME);
Expand Down
22 changes: 11 additions & 11 deletions src/applications/tests/performance_tests/latency_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This test measures the latency of Derecho raw (uncooked) sends in microseconds as a function of
* 1. the number of nodes
* 1. the number of nodes
* 2. the number of senders (all sending, half nodes sending, one sending)
* 3. number of messages sent per sender
* 4. delivery mode (atomic multicast or unordered)
Expand Down Expand Up @@ -50,31 +50,31 @@ struct exp_result {
}
};

#define DEFAULT_PROC_NAME "lat_test"
#define DEFAULT_PROC_NAME "lat_test"

int main(int argc, char* argv[]) {
int dashdash_pos = argc - 1;
while (dashdash_pos > 0) {
if (strcmp(argv[dashdash_pos],"--") == 0) {
while(dashdash_pos > 0) {
if(strcmp(argv[dashdash_pos], "--") == 0) {
break;
}
dashdash_pos -- ;
dashdash_pos--;
}

if((argc-dashdash_pos) < 5) {
if((argc - dashdash_pos) < 5) {
cout << "Insufficient number of command line arguments" << endl;
cout << "USAGE:" << argv[0] << "[ derecho-config-list -- ] num_nodes, num_senders_selector (0 - all senders, 1 - half senders, 2 - one sender), num_messages, delivery_mode (0 - ordered mode, 1 - unordered mode) [proc_name]" << endl;
cout << "Note:proc_name is for ps and pkill commands, defaulted to " DEFAULT_PROC_NAME << std::endl;
cout << "USAGE: " << argv[0] << " [ derecho-config-list -- ] num_nodes, num_senders_selector (0 - all senders, 1 - half senders, 2 - one sender), num_messages, delivery_mode (0 - ordered mode, 1 - unordered mode) [proc_name]" << endl;
std::cout << "Note: proc_name sets the process's name as displayed in ps and pkill commands, default is " DEFAULT_PROC_NAME << std::endl;
return -1;
}

// initialize the special arguments for this test
uint32_t num_nodes = std::stoi(argv[dashdash_pos + 1]);
const uint32_t num_senders_selector = std::stoi(argv[dashdash_pos +2 ]);
const uint32_t num_senders_selector = std::stoi(argv[dashdash_pos + 2]);
const uint32_t num_messages = std::stoi(argv[dashdash_pos + 3]);
const uint32_t delivery_mode = std::stoi(argv[dashdash_pos + 4]);

if ((argc-dashdash_pos) > 5) {
if((argc - dashdash_pos) > 5) {
pthread_setname_np(pthread_self(), argv[dashdash_pos + 5]);
} else {
pthread_setname_np(pthread_self(), DEFAULT_PROC_NAME);
Expand Down Expand Up @@ -227,7 +227,7 @@ int main(int argc, char* argv[]) {
log_results(exp_result{num_nodes, num_senders_selector, msg_size,
getConfUInt32(CONF_SUBGROUP_DEFAULT_WINDOW_SIZE), num_messages,
delivery_mode, avg_latency, avg_std_dev},
"data_latency");
"data_latency");
}
managed_group.barrier_sync();
managed_group.leave();
Expand Down
22 changes: 10 additions & 12 deletions src/applications/tests/performance_tests/persistent_bw_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,24 @@ struct persistent_bw_result {
}
};

#define DEFAULT_PROC_NAME "pers_bw_test"
#define DEFAULT_PROC_NAME "pers_bw_test"

int main(int argc, char* argv[]) {

int dashdash_pos = argc - 1;
while (dashdash_pos > 0) {
if (strcmp(argv[dashdash_pos],"--") == 0) {
while(dashdash_pos > 0) {
if(strcmp(argv[dashdash_pos], "--") == 0) {
break;
}
dashdash_pos -- ;
dashdash_pos--;
}

if((argc-dashdash_pos) < 4) {
if((argc - dashdash_pos) < 4) {
cout << "Invalid command line arguments." << endl;
std::cout << "Usage:" << argv[0] << "[<derecho config options> -- ]<all|half|one> <num_of_nodes> <num_msgs> [proc_name]" << std::endl;
std::cout << "Note:proc_name is for ps and pkill commands, default to " DEFAULT_PROC_NAME << std::endl;
std::cout << "Usage: " << argv[0] << " [<derecho config options> -- ] <all|half|one> <num_of_nodes> <num_msgs> [proc_name]" << std::endl;
std::cout << "Note: proc_name sets the process's name as displayed in ps and pkill commands, default is " DEFAULT_PROC_NAME << std::endl;
return -1;
}

//The maximum number of bytes that can be sent to change_pers_bytes() is not quite MAX_PAYLOAD_SIZE.
//The serialized Bytes object will include its size field as well as the actual buffer, and
//the RPC function header contains an InvocationID (which is a size_t) as well as the header
Expand All @@ -83,7 +82,7 @@ int main(int argc, char* argv[]) {
const int msg_size = derecho::getConfUInt64(CONF_SUBGROUP_DEFAULT_MAX_PAYLOAD_SIZE) - rpc_header_size;
const int num_msgs = atoi(argv[dashdash_pos + 3]);

if ((argc-dashdash_pos) > 4) {
if((argc - dashdash_pos) > 4) {
pthread_setname_np(pthread_self(), argv[dashdash_pos + 4]);
} else {
pthread_setname_np(pthread_self(), DEFAULT_PROC_NAME);
Expand Down Expand Up @@ -147,8 +146,7 @@ int main(int argc, char* argv[]) {

auto ba_factory = [](PersistentRegistry* pr, derecho::subgroup_id_t) { return std::make_unique<ByteArrayObject>(pr); };

derecho::Group<ByteArrayObject> group{callback_set, subgroup_info, {},
std::vector<derecho::view_upcall_t>{}, ba_factory};
derecho::Group<ByteArrayObject> group{callback_set, subgroup_info, {}, std::vector<derecho::view_upcall_t>{}, ba_factory};

std::cout << "Finished constructing/joining Group" << std::endl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
if((argc-dashdash_pos) < 5) {
cout << "Invalid command line arguments." << endl;
std::cout << "USAGE:" << argv[0] << " <all|half|one> <num_of_nodes> <num_msgs> <max_ops> [proc_name]" << std::endl;
std::cout << "Note:proc_name is for ps and pkill commands, default to " DEFAULT_PROC_NAME << std::endl;
std::cout << "Note: proc_name sets the process's name as displayed in ps and pkill commands, default is " DEFAULT_PROC_NAME << std::endl;
return -1;
}
PartialSendMode sender_selector = PartialSendMode::ALL_SENDERS;
Expand Down
32 changes: 25 additions & 7 deletions src/applications/tests/performance_tests/signed_bw_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,24 @@ struct signed_bw_result {
}
};

#define DEFAULT_PROC_NAME "signed_bw_test"

int main(int argc, char* argv[]) {
//std::chrono is too verbose
using namespace std::chrono;

if(argc < 4) {
std::cout << "usage:" << argv[0] << " <all|half|one> <num_of_nodes> <num_msgs>" << std::endl;
int dashdash_pos = argc - 1;
while(dashdash_pos > 0) {
if(strcmp(argv[dashdash_pos], "--") == 0) {
break;
}
dashdash_pos--;
}

if((argc - dashdash_pos) < 4) {
std::cout << "Invalid command line arguments." << std::endl;
std::cout << "Usage: " << argv[0] << " [<derecho config options> -- ] <all|half|one> <num_of_nodes> <num_msgs> [proc_name]" << std::endl;
std::cout << "Note: proc_name sets the process's name as displayed in ps and pkill commands, default is " DEFAULT_PROC_NAME << std::endl;
return -1;
}
pthread_setname_np(pthread_self(), "signed_bw_test");
Expand All @@ -71,13 +83,19 @@ int main(int argc, char* argv[]) {
+ derecho::remote_invocation_utilities::header_space();

PartialSendMode sender_selector = PartialSendMode::ALL_SENDERS;
if(strcmp(argv[1], "half") == 0) sender_selector = PartialSendMode::HALF_SENDERS;
if(strcmp(argv[1], "one") == 0) sender_selector = PartialSendMode::ONE_SENDER;
const int num_of_nodes = atoi(argv[2]);
if(strcmp(argv[dashdash_pos + 1], "half") == 0) sender_selector = PartialSendMode::HALF_SENDERS;
if(strcmp(argv[dashdash_pos + 1], "one") == 0) sender_selector = PartialSendMode::ONE_SENDER;
const int num_of_nodes = atoi(argv[dashdash_pos + 2]);
const int msg_size = derecho::getConfUInt64(CONF_SUBGROUP_DEFAULT_MAX_PAYLOAD_SIZE) - rpc_header_size;
const int num_msgs = atoi(argv[3]);
steady_clock::time_point begin_time, send_complete_time, persist_complete_time, verify_complete_time;
const int num_msgs = atoi(argv[dashdash_pos + 3]);

if((argc - dashdash_pos) > 4) {
pthread_setname_np(pthread_self(), argv[dashdash_pos + 4]);
} else {
pthread_setname_np(pthread_self(), DEFAULT_PROC_NAME);
}

steady_clock::time_point begin_time, send_complete_time, persist_complete_time, verify_complete_time;
bool is_sending = true;

long total_num_messages;
Expand Down
39 changes: 18 additions & 21 deletions src/applications/tests/performance_tests/typed_subgroup_bw_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
#include <time.h>
#include <vector>

#include "log_results.hpp"
#include "aggregate_bandwidth.cpp"
#include "aggregate_bandwidth.hpp"
#include "bytes_object.hpp"
#include "log_results.hpp"
#include <derecho/conf/conf.hpp>
#include <derecho/core/derecho.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/persistent/Persistent.hpp>
#include <derecho/conf/conf.hpp>

using test::Bytes;
using std::endl;
using test::Bytes;

/**
* RPC Object with a single function that accepts a string
Expand Down Expand Up @@ -44,32 +44,30 @@ struct exp_result {
double avg_gbps;
double avg_ops;


void print(std::ofstream& fout) {
fout << num_nodes << " "
fout << num_nodes << " "
<< max_msg_size << " " << window_size << " "
<< count << " "
<< avg_msec << " " << avg_gbps << " "
<< avg_ops << endl;
<< avg_msec << " " << avg_gbps << " "
<< avg_ops << endl;
}
};

#define DEFAULT_PROC_NAME "typed_bw_test"
#define DEFAULT_PROC_NAME "typed_bw_test"

int main(int argc, char* argv[]) {

int dashdash_pos = argc - 1;
while (dashdash_pos > 0) {
if (strcmp(argv[dashdash_pos],"--") == 0) {
while(dashdash_pos > 0) {
if(strcmp(argv[dashdash_pos], "--") == 0) {
break;
}
dashdash_pos -- ;
dashdash_pos--;
}

if((argc-dashdash_pos) < 3) {
if((argc - dashdash_pos) < 3) {
std::cout << "Invalid command line arguments." << std::endl;
std::cout << "USAGE:" << argv[0] << "[ derecho-config-list ] -- <num_of_nodes> <count> [proc_name]" << std::endl;
std::cout << "Note:proc_name is for ps and pkill commands, default to " DEFAULT_PROC_NAME << std::endl;
std::cout << "USAGE: " << argv[0] << " [ derecho-config-list -- ] <num_of_nodes> <count> [proc_name]" << std::endl;
std::cout << "Note: proc_name sets the process's name as displayed in ps and pkill commands, default is " DEFAULT_PROC_NAME << std::endl;
return -1;
}

Expand All @@ -78,15 +76,15 @@ int main(int argc, char* argv[]) {
int num_of_nodes = std::stoi(argv[dashdash_pos + 1]);
uint64_t max_msg_size = derecho::getConfUInt64(CONF_SUBGROUP_DEFAULT_MAX_PAYLOAD_SIZE);
int count = std::stoi(argv[dashdash_pos + 2]);
if (dashdash_pos + 3 < argc) {
if(dashdash_pos + 3 < argc) {
pthread_setname_np(pthread_self(), argv[dashdash_pos + 3]);
} else {
pthread_setname_np(pthread_self(), DEFAULT_PROC_NAME);
}

derecho::SubgroupInfo subgroup_info{[num_of_nodes](
const std::vector<std::type_index>& subgroup_type_order,
const std::unique_ptr<derecho::View>& prev_view, derecho::View& curr_view) {
const std::vector<std::type_index>& subgroup_type_order,
const std::unique_ptr<derecho::View>& prev_view, derecho::View& curr_view) {
if(curr_view.num_members < num_of_nodes) {
std::cout << "not enough members yet:" << curr_view.num_members << " < " << num_of_nodes << std::endl;
throw derecho::subgroup_provisioning_exception();
Expand All @@ -105,9 +103,9 @@ int main(int argc, char* argv[]) {
return subgroup_allocation;
}};

auto ba_factory = [](persistent::PersistentRegistry*,derecho::subgroup_id_t) { return std::make_unique<TestObject>(); };
auto ba_factory = [](persistent::PersistentRegistry*, derecho::subgroup_id_t) { return std::make_unique<TestObject>(); };

derecho::Group<TestObject> group({},subgroup_info,{},std::vector<derecho::view_upcall_t>{},ba_factory);
derecho::Group<TestObject> group({}, subgroup_info, {}, std::vector<derecho::view_upcall_t>{}, ba_factory);
std::cout << "Finished constructing/joining Group" << std::endl;

derecho::Replicated<TestObject>& handle = group.get_subgroup<TestObject>();
Expand Down Expand Up @@ -150,7 +148,6 @@ int main(int argc, char* argv[]) {
double avg_gbps = aggregate_bandwidth(members_order, members_order[node_rank], thp_gbps);
double avg_ops = aggregate_bandwidth(members_order, members_order[node_rank], thp_ops);


if(node_rank == 0) {
log_results(exp_result{num_of_nodes, max_msg_size,
derecho::getConfUInt32(CONF_SUBGROUP_DEFAULT_WINDOW_SIZE), count,
Expand Down
4 changes: 2 additions & 2 deletions src/core/git_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace derecho {
const int MAJOR_VERSION = 2;
const int MINOR_VERSION = 0;
const int PATCH_VERSION = 1;
const int COMMITS_AHEAD_OF_VERSION = 67;
const int COMMITS_AHEAD_OF_VERSION = 101;
const char* VERSION_STRING = "2.0.1";
const char* VERSION_STRING_PLUS_COMMITS = "2.0.1+67";
const char* VERSION_STRING_PLUS_COMMITS = "2.0.1+101";

}

0 comments on commit 9309e41

Please sign in to comment.