-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added functions to access pointer to Mercury buffer
- Loading branch information
Showing
10 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_executable (21_encoding_server server.cpp) | ||
target_link_libraries (21_encoding_server thallium) | ||
add_executable (21_encoding_client client.cpp) | ||
target_link_libraries (21_encoding_client thallium) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <iostream> | ||
#include <thallium.hpp> | ||
#include "encoder.hpp" | ||
|
||
namespace tl = thallium; | ||
|
||
int main(int argc, char** argv) { | ||
if(argc != 2) { | ||
std::cerr << "Usage: " << argv[0] << " <address>" << std::endl; | ||
exit(0); | ||
} | ||
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE); | ||
tl::remote_procedure stream = myEngine.define("stream"); | ||
tl::endpoint server = myEngine.lookup(argv[1]); | ||
encoder e; | ||
stream.on(server)(e); | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <iostream> | ||
|
||
class encoder { | ||
|
||
public: | ||
|
||
template<typename A> | ||
void save(A& ar) const { | ||
auto buffer = static_cast<char*>(ar.save_ptr(26)); | ||
for(int i = 0; i < 26; ++i) { | ||
buffer[i] = 'A' + i; | ||
} | ||
ar.restore_ptr(buffer, 26); | ||
} | ||
|
||
template<typename A> | ||
void load(A& ar) { | ||
auto buffer = static_cast<char*>(ar.save_ptr(26)); | ||
for(int i = 0; i < 26; ++i) { | ||
std::cout << buffer[i]; | ||
} | ||
std::cout << std::endl; | ||
ar.restore_ptr(buffer, 26); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <iostream> | ||
#include <thallium.hpp> | ||
#include "encoder.hpp" | ||
|
||
namespace tl = thallium; | ||
|
||
int main() { | ||
|
||
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE); | ||
std::cout << "Server running at address " << myEngine.self() << std::endl; | ||
|
||
std::function<void(const tl::request&, const encoder&)> stream = | ||
[&myEngine](const tl::request& req, const encoder&) { | ||
req.respond(); | ||
}; | ||
|
||
myEngine.define("stream", stream); | ||
myEngine.wait_for_finalize(); | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
spack: | ||
specs: | ||
- mochi-margo ^mercury~boostsys~checksum ^libfabric fabrics=tcp,rxm | ||
- pkg-config | ||
- cmake | ||
- cereal | ||
concretizer: | ||
unify: true | ||
reuse: true | ||
modules: | ||
prefix_inspections: | ||
lib: [LD_LIBRARY_PATH] | ||
lib64: [LD_LIBRARY_PATH] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters