The usual hello world example in TPO++ can be found below:
#include <iostream> #include <tpo++.H> int main(int argc, char *argv[]) { TPO::init(&argc, &argv); cout << "Hello world from host " << TPO::CommWorld.rank() << endl; }
All objects, functions and global variables of TPO++ are encapsulated in a namespace TPO. To use them, you have to provide a prefix TPO::. In the example above, the global initialization function TPO::init is used to start up the message-passing environment. Each host prints ``hello world'' message and its own communication rank, using the rank() method of the global object TPO::CommWorld. An alternative would be to state using namespace TPO to import all TPO++ symbols into the default namespace. For clarity, all our examples use the explicit TPO:: prefix.