Skip to content

Commit 2d66457

Browse files
committed
#2378: apply clang-format to src, examples, tests
1 parent 5ee9ccf commit 2d66457

File tree

886 files changed

+16878
-18677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

886 files changed

+16878
-18677
lines changed

examples/callback/callback.cc

+10-15
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ struct TestMsg : vt::Message {
5353

5454
explicit TestMsg(int in_val, std::string const& in_s = "hello")
5555
: val_(in_val),
56-
s_(in_s)
57-
{ }
56+
s_(in_s) { }
5857

5958
template <typename SerializerT>
6059
void serialize(SerializerT& s) {
@@ -69,9 +68,7 @@ struct TestMsg : vt::Message {
6968

7069
// Message containing the callback to invoke
7170
struct HelloMsg : vt::Message {
72-
explicit HelloMsg(vt::Callback<TestMsg> in_cb)
73-
: cb_(in_cb)
74-
{ }
71+
explicit HelloMsg(vt::Callback<TestMsg> in_cb) : cb_(in_cb) { }
7572

7673
vt::Callback<TestMsg> cb_;
7774
};
@@ -85,14 +82,14 @@ void hello_world(HelloMsg* msg) {
8582

8683
void printOutput(TestMsg* msg, std::string type) {
8784
vt::NodeType this_node = vt::theContext()->getNode();
88-
fmt::print("{}: cb {}: val={}, str={}\n", this_node, type, msg->val_, msg->s_);
85+
fmt::print(
86+
"{}: cb {}: val={}, str={}\n", this_node, type, msg->val_, msg->s_
87+
);
8988
}
9089

9190
// Functor callback endpoint
9291
struct CallbackFunctor {
93-
void operator()(TestMsg* msg) {
94-
printOutput(msg, "CallbackFunctor");
95-
}
92+
void operator()(TestMsg* msg) { printOutput(msg, "CallbackFunctor"); }
9693
};
9794

9895
// Function callback endpoint
@@ -102,9 +99,7 @@ static void callbackFunc(TestMsg* msg) {
10299

103100
struct MyObj {
104101
// Objgroup callback endpoint
105-
void handler(TestMsg* msg) {
106-
printOutput(msg, "MyObj::handler");
107-
}
102+
void handler(TestMsg* msg) { printOutput(msg, "MyObj::handler"); }
108103
};
109104

110105
struct MyCol : vt::Collection<MyCol, vt::Index1D> { };
@@ -131,9 +126,9 @@ int main(int argc, char** argv) {
131126

132127
auto obj = vt::theObjGroup()->makeCollective<MyObj>("examples_callback");
133128
auto col = vt::makeCollection<MyCol>("examples_callback")
134-
.bounds(vt::Index1D(8))
135-
.bulkInsert()
136-
.wait();
129+
.bounds(vt::Index1D(8))
130+
.bulkInsert()
131+
.wait();
137132

138133
if (this_node == 0) {
139134
vt::NodeType dest = num_nodes > 2 ? 2 : 0;

examples/callback/callback_context.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static void callbackFn(DataMsg* msg, MyContext* ctx) {
8787
static void handler(CallbackMsg* msg) {
8888
auto cb = msg->cb;
8989
auto data_msg = vt::makeMessage<DataMsg>();
90-
data_msg->vec_ = std::vector<int>{18,45,28,-1,344};
90+
data_msg->vec_ = std::vector<int>{18, 45, 28, -1, 344};
9191
fmt::print("handler: vec.size={}\n", data_msg->vec_.size());
9292
cb.sendMsg(data_msg);
9393
}
@@ -109,7 +109,7 @@ int main(int argc, char** argv) {
109109
my_global_ctx.x = 1283;
110110

111111
// Make a callback that triggers the callback with a context
112-
auto cb = vt::theCB()->makeFunc<DataMsg,MyContext>(
112+
auto cb = vt::theCB()->makeFunc<DataMsg, MyContext>(
113113
vt::pipe::LifetimeEnum::Once, &my_global_ctx, callbackFn
114114
);
115115

examples/collection/4d_collection.cc

+4-7
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,29 @@
4444
#include <vt/transport.h>
4545

4646
struct Example4D : vt::Collection<Example4D, vt::Index4D> {
47-
4847
Example4D() = default;
4948

5049
void hello() {
5150
fmt::print(
5251
"{}: Hello from Example4D: {}\n", vt::theContext()->getNode(), getIndex()
5352
);
5453
}
55-
5654
};
5755

5856
int main(int argc, char** argv) {
5957
vt::initialize(argc, argv);
6058

61-
auto range = vt::Index4D(2,4,3,2);
59+
auto range = vt::Index4D(2, 4, 3, 2);
6260

6361
auto proxy = vt::makeCollection<Example4D>("4d_collection")
64-
.bounds(range)
65-
.bulkInsert()
66-
.wait();
62+
.bounds(range)
63+
.bulkInsert()
64+
.wait();
6765

6866
if (vt::theContext()->getNode() == 0) {
6967
proxy.broadcast<&Example4D::hello>();
7068
}
7169

72-
7370
vt::finalize();
7471
return 0;
7572
}

examples/collection/do_flops_perf.cc

+16-13
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ double pi(uint64_t n) {
5555
double sum = 0.0;
5656
int sign = 1;
5757
for (uint64_t i = 0; i < n; ++i) {
58-
sum += sign/(2.0*i+1.0);
58+
sum += sign / (2.0 * i + 1.0);
5959
sign *= -1;
6060
}
61-
return 4.0*sum;
61+
return 4.0 * sum;
6262
}
6363

6464
struct GenericWork : vt::Collection<GenericWork, vt::Index1D> {
@@ -75,17 +75,16 @@ struct GenericWork : vt::Collection<GenericWork, vt::Index1D> {
7575
// ----------------------------------------------------------
7676

7777
vt::theContext()->getTask()->stopMetrics();
78-
std::unordered_map<std::string, uint64_t> res = vt::theContext()->getTask()->getMetrics();
78+
std::unordered_map<std::string, uint64_t> res =
79+
vt::theContext()->getTask()->getMetrics();
7980
for (auto [name, value] : res) {
8081
fmt::print(" {}: {}\n", name, value);
8182
}
8283

8384
fmt::print("-- Stopping Iteration --\n");
8485
}
8586

86-
void init(int in_flops_per_iter) {
87-
flopsPerIter_ = in_flops_per_iter;
88-
}
87+
void init(int in_flops_per_iter) { flopsPerIter_ = in_flops_per_iter; }
8988

9089
private:
9190
size_t flopsPerIter_ = 0;
@@ -105,7 +104,9 @@ int main(int argc, char** argv) {
105104

106105
if (argc == 1) {
107106
if (this_node == 0) {
108-
fmt::print(stderr, "{}: using default arguments since none provided\n", name);
107+
fmt::print(
108+
stderr, "{}: using default arguments since none provided\n", name
109+
);
109110
}
110111
num_objs = default_num_objs * num_nodes;
111112
} else if (argc == 2) {
@@ -118,24 +119,26 @@ int main(int argc, char** argv) {
118119
flopsPerIter = static_cast<size_t>(strtol(argv[2], nullptr, 10));
119120
maxIter = static_cast<size_t>(strtol(argv[3], nullptr, 10));
120121
} else {
121-
fmt::print(stderr, "usage: {} <num-objects> <flops-per-iter> <maxiter>\n", name);
122+
fmt::print(
123+
stderr, "usage: {} <num-objects> <flops-per-iter> <maxiter>\n", name
124+
);
122125
return 1;
123126
}
124127

125128
using BaseIndexType = typename vt::Index1D::DenseIndexType;
126129
auto range = vt::Index1D(static_cast<BaseIndexType>(num_objs));
127130

128131
auto col_proxy = vt::makeCollection<GenericWork>("examples_generic_work")
129-
.bounds(range)
130-
.bulkInsert()
131-
.wait();
132+
.bounds(range)
133+
.bulkInsert()
134+
.wait();
132135

133-
vt::runInEpochCollective([&]{
136+
vt::runInEpochCollective([&] {
134137
col_proxy.broadcastCollective<&GenericWork::init>(flopsPerIter);
135138
});
136139

137140
for (std::size_t i = 0; i < maxIter; i++) {
138-
vt::runInEpochCollective([&]{
141+
vt::runInEpochCollective([&] {
139142
col_proxy.broadcastCollective<&GenericWork::doIteration>();
140143
});
141144
vt::thePhase()->nextPhaseCollective();

examples/collection/insertable_collection.cc

+4-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct InsertCol : vt::Collection<InsertCol, vt::Index1D> {
5555
int main(int argc, char** argv) {
5656
vt::initialize(argc, argv);
5757

58-
if(vt::theContext()->getNumNodes() < 2){
58+
if (vt::theContext()->getNumNodes() < 2) {
5959
vt::finalize();
6060
return 0;
6161
}
@@ -70,8 +70,8 @@ int main(int argc, char** argv) {
7070

7171
auto range = vt::Index1D(num_elms);
7272
auto proxy = vt::makeCollection<InsertCol>("examples_insertable_collection")
73-
.dynamicMembership(true)
74-
.wait();
73+
.dynamicMembership(true)
74+
.wait();
7575

7676
{
7777
auto token = proxy.beginModification();
@@ -89,7 +89,7 @@ int main(int argc, char** argv) {
8989
{
9090
auto token = proxy.beginModification();
9191

92-
for (int i = range.x()/2; i < range.x(); i++) {
92+
for (int i = range.x() / 2; i < range.x(); i++) {
9393
if (i % num_nodes == this_node) {
9494
proxy[i].insertAt(token, i % 2);
9595
}
@@ -98,7 +98,6 @@ int main(int argc, char** argv) {
9898
fmt::print("called finishedModification (2)\n");
9999
}
100100

101-
102101
vt::finalize();
103102

104103
return 0;

0 commit comments

Comments
 (0)