Skip to content

Commit

Permalink
updated thallium examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorier committed Aug 23, 2024
1 parent 0032cb3 commit b3844cf
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions code/thallium/01_init/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << myEngine.self() << std::endl;

myEngine.wait_for_finalize();
return 0;
}
2 changes: 2 additions & 0 deletions code/thallium/02_hello/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ int main(int argc, char** argv) {
myEngine.define("hello", hello).disable_response();
std::cout << "Server running at address " << myEngine.self() << std::endl;

myEngine.wait_for_finalize();

return 0;
}
2 changes: 2 additions & 0 deletions code/thallium/03_args/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ int main(int argc, char** argv) {
std::cout << "Server running at address " << myEngine.self() << std::endl;
myEngine.define("sum", sum);

myEngine.wait_for_finalize();

return 0;
}
2 changes: 2 additions & 0 deletions code/thallium/04_lambdas/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ int main(int argc, char** argv) {

myEngine.define("sum", sum);

myEngine.wait_for_finalize();

return 0;
}
2 changes: 2 additions & 0 deletions code/thallium/05_stop/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ int main(int argc, char** argv) {

myEngine.define("sum", sum);

myEngine.wait_for_finalize();

return 0;
}
2 changes: 2 additions & 0 deletions code/thallium/06_stl/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ int main(int argc, char** argv) {
tl::engine myEngine("tcp://127.0.0.1:1234", THALLIUM_SERVER_MODE);
myEngine.define("hello", hello).disable_response();

myEngine.wait_for_finalize();

return 0;
}
2 changes: 2 additions & 0 deletions code/thallium/08_rdma/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ int main(int argc, char** argv) {
req.respond();
};
myEngine.define("do_rdma",f);

myEngine.wait_for_finalize();
}
7 changes: 2 additions & 5 deletions code/thallium/09_providers/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ class my_sum_provider : public tl::provider<my_sum_provider> {
define("hello", &my_sum_provider::hello);
define("print", &my_sum_provider::print, tl::ignore_return_value());
}

~my_sum_provider() {
get_engine().wait_for_finalize();
}
};

int main(int argc, char** argv) {
Expand All @@ -49,6 +45,7 @@ int main(int argc, char** argv) {
std::cout << "Server running at address " << myEngine.self()
<< " with provider id " << provider_id << std::endl;
my_sum_provider myProvider(myEngine, provider_id);

myEngine.wait_for_finalize();

return 0;
}
13 changes: 8 additions & 5 deletions code/thallium/12_rpc_pool/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ int main(int argc, char** argv) {

tl::abt scope;

tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);

std::vector<tl::managed<tl::xstream>> ess;
tl::managed<tl::pool> myPool = tl::pool::create(tl::pool::access::spmc);
for(int i=0; i < 4; i++) {
tl::managed<tl::xstream> es
= tl::xstream::create(tl::scheduler::predef::deflt, *myPool);
ess.push_back(std::move(es));
}
std::cout << "Server running at address " << myEngine.self() << std::endl;
myEngine.define("sum", sum, 0, *myPool);

myEngine.wait_for_finalize();
{
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);

std::cout << "Server running at address " << myEngine.self() << std::endl;
myEngine.define("sum", sum, 0, *myPool);

myEngine.wait_for_finalize();
}

for(int i=0; i < 4; i++) {
ess[i]->join();
Expand Down
2 changes: 2 additions & 0 deletions code/thallium/16_context/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ int main() {

myEngine.define("process", process);

myEngine.wait_for_finalize();

return 0;
}

0 comments on commit b3844cf

Please sign in to comment.