Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
update on smpirun script to accept -trace argument with the name of the tracefile
[simgrid.git] / src / smpi / smpi_comm.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5   * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "private.h"
8
9 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi,
10                                 "Logging specific to SMPI (comm)");
11
12 typedef struct s_smpi_mpi_communicator {
13   MPI_Group group;
14 } s_smpi_mpi_communicator_t;
15
16 MPI_Comm smpi_comm_new(MPI_Group group) {
17   MPI_Comm comm;
18
19   comm = xbt_new(s_smpi_mpi_communicator_t, 1);
20   comm->group = group;
21   smpi_group_use(comm->group);
22   return comm;
23 }
24
25 void smpi_comm_destroy(MPI_Comm comm) {
26   smpi_group_destroy(comm->group);
27   xbt_free(comm);
28 }
29
30 MPI_Group smpi_comm_group(MPI_Comm comm) {
31   return comm->group;
32 }
33
34 int smpi_comm_size(MPI_Comm comm) {
35   return smpi_group_size(smpi_comm_group(comm));
36 }
37
38 int smpi_comm_rank(MPI_Comm comm) {
39   return smpi_group_rank(smpi_comm_group(comm), smpi_process_index());
40 }