RCCE_MPI.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "RCCE.h"
  2. #include "RCCE_lib.h"
  3. #include <stdlib.h>
  4. #include <string.h>
  5. // We abuse the MPI_Datatype to convery information about the size of the
  6. // data type
  7. int MPI_Send(void *buf, int count, int type_size, int dest, int tag, RCCE_COMM comm) {
  8. return(RCCE_send((char *)buf, count*type_size, comm.member[dest]));
  9. }
  10. int MPI_Recv(void *buf, int count, int type_size, int source, int tag,
  11. RCCE_COMM comm, int *status) {
  12. return(RCCE_recv((char *)buf, count*type_size, comm.member[source]));
  13. }
  14. int MPI_Comm_size(RCCE_COMM comm, int *size) {
  15. *size = comm.size;
  16. return(RCCE_SUCCESS);
  17. }
  18. int MPI_Comm_rank(RCCE_COMM comm, int *rank) {
  19. *rank = comm.my_rank;
  20. return(RCCE_SUCCESS);
  21. }
  22. int MPI_Init(int *argc, char ***argv) {
  23. return(RCCE_init(argc, argv));
  24. }
  25. int MPI_Finalize(void) {
  26. return(RCCE_finalize());
  27. }
  28. double MPI_Wtime(void) {
  29. // Somehow, this does not work; must replace MPI_Wtime with RCCE_wtime directly
  30. return(RCCE_wtime());
  31. }
  32. int MPI_Abort(RCCE_COMM comm, int code) {
  33. exit(1);
  34. }
  35. int MPI_Comm_free(RCCE_COMM *comm) {
  36. return(RCCE_comm_free(comm));
  37. }