test_mpi.c 857 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <mpi.h>
  2. #ifdef __cplusplus
  3. # include <cstdio>
  4. #else
  5. # include <stdio.h>
  6. #endif
  7. #if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
  8. const char mpiver_str[] = { 'I', 'N',
  9. 'F', 'O',
  10. ':', 'M',
  11. 'P', 'I',
  12. '-', 'V',
  13. 'E', 'R',
  14. '[', ('0' + MPI_VERSION),
  15. '.', ('0' + MPI_SUBVERSION),
  16. ']', '\0' };
  17. #endif
  18. int main(int argc, char* argv[])
  19. {
  20. #if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
  21. # ifdef __cplusplus
  22. std::puts(mpiver_str);
  23. # else
  24. puts(mpiver_str);
  25. # endif
  26. #endif
  27. #ifdef TEST_MPI_MPICXX
  28. MPI::MPI_Init(&argc, &argv);
  29. MPI::MPI_Finalize();
  30. #else
  31. MPI_Init(&argc, &argv);
  32. MPI_Finalize();
  33. #endif
  34. return 0;
  35. }