1
1
openmpi/examples/hello_oshmem_cxx.cc
Gilles Gouaillardet d1740a679c oshmem: add C++ wrappers
though there are no C++ bindings for oshmem, we need C++ wrappers
since a C compiler might not be able to compile a C++ source.
the C++ wrappers are :
- shmemc++ / oshc++
- shmemcxx / oshcxx
- shmemCC / oshCC (on case sensitive filesystems)

also add the examples/hello_oshmem_cxx.cc example

Thanks Bert Wesarg for bringing this to our attention

Fixes open-mpi/ompi#2097

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
2017-09-01 13:24:34 +09:00

40 строки
1010 B
C++

/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <iostream>
#include "shmem.h"
#if !defined(OSHMEM_SPEC_VERSION) || OSHMEM_SPEC_VERSION < 10200
#error This application uses API 1.2 and up
#endif
int main(int argc, char* argv[])
{
int proc, nproc;
char name[SHMEM_MAX_NAME_LEN];
int major, minor;
shmem_init();
nproc = shmem_n_pes();
proc = shmem_my_pe();
shmem_info_get_name(name);
shmem_info_get_version(&major, &minor);
std::cout << "Hello, world, I am " << proc << " of " << nproc << ": " << name
<< " (version: " << major << "." << minor << ")" << std::endl;
shmem_finalize();
return 0;
}