Derived from http://www.openshmem.org/site/Downloads/Examples