Skip to content

Commit f1778d2

Browse files
committed
communicator: remove the USE_MUTEX_FOR_COMMS macro
It should have always been #define'd in order to correctly handle the multi-threaded case. Also fix indentation in ompi/mpi/c/comm_get_errhandler.c Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 7c3e675 commit f1778d2

File tree

5 files changed

+17
-35
lines changed

5 files changed

+17
-35
lines changed

ompi/communicator/comm.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,16 +1315,12 @@ int ompi_comm_compare(ompi_communicator_t *comm1, ompi_communicator_t *comm2, in
13151315
int ompi_comm_set_name (ompi_communicator_t *comm, const char *name )
13161316
{
13171317

1318-
#ifdef USE_MUTEX_FOR_COMMS
13191318
OPAL_THREAD_LOCK(&(comm->c_lock));
1320-
#endif
13211319
memset(comm->c_name, 0, MPI_MAX_OBJECT_NAME);
13221320
strncpy(comm->c_name, name, MPI_MAX_OBJECT_NAME);
13231321
comm->c_name[MPI_MAX_OBJECT_NAME - 1] = 0;
13241322
comm->c_flags |= OMPI_COMM_NAMEISSET;
1325-
#ifdef USE_MUTEX_FOR_COMMS
13261323
OPAL_THREAD_UNLOCK(&(comm->c_lock));
1327-
#endif
13281324

13291325
return OMPI_SUCCESS;
13301326
}

ompi/communicator/comm_init.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,7 @@ static void ompi_comm_construct(ompi_communicator_t* comm)
387387
#ifdef OMPI_WANT_PERUSE
388388
comm->c_peruse_handles = NULL;
389389
#endif
390-
#ifdef USE_MUTEX_FOR_COMMS
391390
OBJ_CONSTRUCT(&comm->c_lock, opal_mutex_t);
392-
#endif
393391
}
394392

395393
static void ompi_comm_destruct(ompi_communicator_t* comm)

ompi/mpi/c/comm_get_errhandler.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,27 @@ int MPI_Comm_get_errhandler(MPI_Comm comm, MPI_Errhandler *errhandler)
5050

5151
OPAL_CR_NOOP_PROGRESS();
5252

53-
/* Error checking */
53+
/* Error checking */
5454

55-
if (MPI_PARAM_CHECK) {
56-
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
57-
if (ompi_comm_invalid(comm)) {
58-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
59-
FUNC_NAME);
60-
} else if (NULL == errhandler) {
61-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
62-
FUNC_NAME);
55+
if (MPI_PARAM_CHECK) {
56+
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
57+
if (ompi_comm_invalid(comm)) {
58+
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
59+
FUNC_NAME);
60+
} else if (NULL == errhandler) {
61+
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
62+
FUNC_NAME);
63+
}
6364
}
64-
}
6565

66-
#ifdef USE_MUTEX_FOR_COMMS
6766
OPAL_THREAD_LOCK(&(comm->c_lock));
68-
#endif
69-
/* Retain the errhandler, corresponding to object refcount decrease
70-
in errhandler_free.c. */
71-
OBJ_RETAIN(comm->error_handler);
72-
*errhandler = comm->error_handler;
73-
#ifdef USE_MUTEX_FOR_COMMS
67+
/* Retain the errhandler, corresponding to object refcount decrease
68+
in errhandler_free.c. */
69+
OBJ_RETAIN(comm->error_handler);
70+
*errhandler = comm->error_handler;
7471
OPAL_THREAD_UNLOCK(&(comm->c_lock));
75-
#endif
7672

77-
/* All done */
73+
/* All done */
7874

79-
return MPI_SUCCESS;
75+
return MPI_SUCCESS;
8076
}

ompi/mpi/c/comm_get_name.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
13+
* Copyright (c) 2015-2017 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
1616
*
@@ -60,9 +60,7 @@ int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length)
6060
return OMPI_ERRHANDLER_INVOKE ( comm, MPI_ERR_ARG,
6161
FUNC_NAME);
6262
}
63-
#ifdef USE_MUTEX_FOR_COMMS
6463
OPAL_THREAD_LOCK(&(comm->c_lock));
65-
#endif
6664
/* Note that MPI-2.1 requires:
6765
- terminating the string with a \0
6866
- name[*resultlen] == '\0'
@@ -80,9 +78,7 @@ int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length)
8078
name[0] = '\0';
8179
*length = 0;
8280
}
83-
#ifdef USE_MUTEX_FOR_COMMS
8481
OPAL_THREAD_UNLOCK(&(comm->c_lock));
85-
#endif
8682

8783
return MPI_SUCCESS;
8884
}

ompi/mpi/c/comm_set_errhandler.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,12 @@ int MPI_Comm_set_errhandler(MPI_Comm comm, MPI_Errhandler errhandler)
6969
/* Prepare the new error handler */
7070
OBJ_RETAIN(errhandler);
7171

72-
#ifdef USE_MUTEX_FOR_COMMS
7372
OPAL_THREAD_LOCK(&(comm->c_lock));
74-
#endif
7573
/* Ditch the old errhandler, and decrement its refcount. */
7674
tmp = comm->error_handler;
7775
comm->error_handler = errhandler;
7876
OBJ_RELEASE(tmp);
79-
#ifdef USE_MUTEX_FOR_COMMS
8077
OPAL_THREAD_UNLOCK(&(comm->c_lock));
81-
#endif
8278

8379
/* All done */
8480
return MPI_SUCCESS;

0 commit comments

Comments
 (0)