Hi, this is excellent work. I want to kindly ask if you could give me some examples about how to send string using FMI::Communicator(I tried Data<void*> but the bcast seems failed) and how to deploy the FMI in distributed nodes, I think I should deploy TCPPunch in one node. And give different arguments to different nodes?
constexpr int num_peers = 4;
std::vector<FMI::Comm::Data<void*>> d(num_peers);
const char* message = "abc";
d[0] = FMI::Comm::Data<void*>(const_cast<char*>(message), std::strlen(message) + 1);
int peer_id = 0;
for (int i = 1; i < num_peers; i++) {
int pid = fork();
if (pid == 0) {
peer_id = i;
break;
}
}
auto ch = std::make_unique<FMI::Communicator>(peer_id, num_peers, config_path, comm_name);
ch->bcast(d[peer_id], 0);
char* received_data = reinterpret_cast<char*>(d[peer_id].get());
if (std::strcmp(received_data, "abc") == 0) {
std::cout << "Peer " << peer_id << " received correct data: " << received_data << std::endl;
} else {
std::cerr << "Peer " << peer_id << " received incorrect data: " << received_data << std::endl;
}
For this code only output "Peer 0 received correct data: abc" no other process output