Commit 4eeb7b9e authored by Matthieu Dorier's avatar Matthieu Dorier

reorganized tests to not depend on MPI

parent ad20e53f
add_executable(TestHelloWorld TestHelloWorld.cpp)
target_link_libraries(TestHelloWorld thallium)
add_executable(TestHelloWorldServer TestHelloWorldServer.cpp)
target_link_libraries(TestHelloWorldServer thallium)
add_executable(TestHelloWorldClient TestHelloWorldClient.cpp)
target_link_libraries(TestHelloWorldClient thallium)
add_executable(TestSerialization TestSerialization.cpp)
target_link_libraries(TestSerialization thallium)
add_executable(TestBulk TestBulk.cpp)
target_link_libraries(TestBulk thallium)
add_executable(TestBulkClient TestBulkClient.cpp)
target_link_libraries(TestBulkClient thallium)
add_executable(TestBulkServer TestBulkServer.cpp)
target_link_libraries(TestBulkServer thallium)
/*
* See COPYRIGHT in top-level directory.
*/
#include <unistd.h>
#include <iostream>
#include <thallium.hpp>
#include <thallium/serialization/stl/string.hpp>
namespace tl = thallium;
int client() {
tl::engine margo("bmi+tcp", MARGO_CLIENT_MODE);
auto remote_send = margo.define("send_bulk").ignore_response();
auto remote_stop = margo.define("stop").ignore_response();
std::string server_addr = "bmi+tcp://127.0.0.1:1234";
sleep(1);
auto server_endpoint = margo.lookup(server_addr);
std::cout << "Lookup done for endpoint " << (std::string)server_endpoint << std::endl;
std::string buf = "Matthieu";
std::vector<std::pair<void*,std::size_t>> seg(1);
seg[0].first = (void*)(&buf[0]);
seg[0].second = buf.size()+1;
tl::bulk b = margo.expose(seg, tl::bulk_mode::read_only);
remote_send.on(server_endpoint)(b);
remote_stop.on(server_endpoint)();
return 0;
}
int main(int argc, char** argv) {
client();
return 0;
}
/*
* See COPYRIGHT in top-level directory.
*/
#include <mpi.h>
#include <unistd.h>
#include <iostream>
#include <thallium.hpp>
......@@ -41,42 +40,7 @@ int server() {
return 0;
}
int client() {
tl::engine margo("bmi+tcp", MARGO_CLIENT_MODE);
auto remote_send = margo.define("send_bulk").ignore_response();
auto remote_stop = margo.define("stop").ignore_response();
std::string server_addr = "bmi+tcp://127.0.0.1:1234";
sleep(1);
auto server_endpoint = margo.lookup(server_addr);
std::cout << "Lookup done for endpoint " << (std::string)server_endpoint << std::endl;
std::string buf = "Matthieu";
std::vector<std::pair<void*,std::size_t>> seg(1);
seg[0].first = (void*)(&buf[0]);
seg[0].second = buf.size()+1;
tl::bulk b = margo.expose(seg, tl::bulk_mode::read_only);
remote_send.on(server_endpoint)(b);
remote_stop.on(server_endpoint)();
return 0;
}
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(rank == 0) server();
else client();
std::cout << "Rank " << rank << " finished its work" << std::endl;
MPI_Finalize();
server();
return 0;
}
/*
* See COPYRIGHT in top-level directory.
*/
#include <unistd.h>
#include <iostream>
#include <thallium.hpp>
#include <thallium/serialization/stl/string.hpp>
namespace tl = thallium;
int client() {
tl::engine margo("bmi+tcp", MARGO_CLIENT_MODE);
auto remote_hello = margo.define("hello").ignore_response();
auto remote_sum = margo.define("sum");
auto remote_stop = margo.define("stop").ignore_response();
std::string server_addr = "bmi+tcp://127.0.0.1:1234";
sleep(1);
auto server_endpoint = margo.lookup(server_addr);
std::cout << "Lookup done for endpoint " << (std::string)server_endpoint << std::endl;
remote_hello.on(server_endpoint)(std::string("Matt"));
int ret = remote_sum.on(server_endpoint)(23,67);
std::cout << "Server returned " << ret << std::endl;
remote_stop.on(server_endpoint)();
return 0;
}
int main(int argc, char** argv) {
client();
return 0;
}
/*
* See COPYRIGHT in top-level directory.
*/
#include <mpi.h>
#include <unistd.h>
#include <iostream>
#include <thallium.hpp>
......@@ -38,40 +37,7 @@ int server() {
return 0;
}
int client() {
tl::engine margo("bmi+tcp", MARGO_CLIENT_MODE);
auto remote_hello = margo.define("hello").ignore_response();
auto remote_sum = margo.define("sum");
auto remote_stop = margo.define("stop").ignore_response();
std::string server_addr = "bmi+tcp://127.0.0.1:1234";
sleep(1);
auto server_endpoint = margo.lookup(server_addr);
std::cout << "Lookup done for endpoint " << (std::string)server_endpoint << std::endl;
remote_hello.on(server_endpoint)(std::string("Matt"));
int ret = remote_sum.on(server_endpoint)(23,67);
std::cout << "Server returned " << ret << std::endl;
remote_stop.on(server_endpoint)();
return 0;
}
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(rank == 0) server();
else client();
std::cout << "Rank " << rank << " finished its work" << std::endl;
MPI_Finalize();
server();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment