A simple "hello world" example in which every unit sends a string to std::cout
containing it's dash::myid()
, the dash::size()
, the name of the host and it's process id.
#include <unistd.h>
#include <iostream>
#include <cstddef>
#include <sstream>
#include <libdash.h>
int main(int argc, char* argv[])
{
pid_t pid;
char buf[100];
gethostname(buf, 100);
pid = getpid();
std::ostringstream os;
os << "'Hello world' from "
<<
"unit " <<
myid <<
" of " <<
size <<
" " << "on " << buf << " pid=" << pid
<< endl;
cout << os.str();
return EXIT_SUCCESS;
}