Commit 41abeaa2 authored by William Gropp's avatar William Gropp
Browse files

[svn-r5355] Added (or moved) MPIU_THREADPRIV_DECL so that the thread-private...

[svn-r5355] Added (or moved) MPIU_THREADPRIV_DECL so that the thread-private area is acquired only once within a routine, since the data (pointer to the thread-private area) is fixed during the execution.  This reduces the overhead of the nest increment/decrement, for example
parent aa61523b
......@@ -326,6 +326,7 @@ int MPI_Alltoallv(void *sendbuf, int *sendcnts, int *sdispls,
static const char FCNAME[] = "MPI_Alltoallv";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ALLTOALLV);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -417,7 +418,6 @@ int MPI_Alltoallv(void *sendbuf, int *sendcnts, int *sdispls,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -344,6 +344,7 @@ int MPI_Alltoallw(void *sendbuf, int *sendcnts, int *sdispls,
static const char FCNAME[] = "MPI_Alltoallw";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ALLTOALLW);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -443,7 +444,6 @@ int MPI_Alltoallw(void *sendbuf, int *sendcnts, int *sdispls,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -365,6 +365,7 @@ int MPI_Barrier( MPI_Comm comm )
{
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_BARRIER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -408,7 +409,6 @@ int MPI_Barrier( MPI_Comm comm )
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
if (comm_ptr->comm_kind == MPID_INTRACOMM) {
......
......@@ -1206,6 +1206,7 @@ int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root,
{
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_BCAST);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -282,6 +282,7 @@ int MPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
static const char FCNAME[] = "MPI_Exscan";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_EXSCAN);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -360,7 +361,6 @@ int MPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -615,6 +615,7 @@ int MPI_Gather(void *sendbuf, int sendcnt, MPI_Datatype sendtype,
static const char FCNAME[] = "MPI_Gather";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GATHER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -722,7 +723,6 @@ int MPI_Gather(void *sendbuf, int sendcnt, MPI_Datatype sendtype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -212,6 +212,7 @@ int MPI_Gatherv(void *sendbuf, int sendcnt, MPI_Datatype sendtype,
static const char FCNAME[] = "MPI_Gatherv";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GATHERV);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -336,7 +337,6 @@ int MPI_Gatherv(void *sendbuf, int sendcnt, MPI_Datatype sendtype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -54,6 +54,7 @@ int MPI_Op_commutative(MPI_Op op, int *commute)
{
MPID_Op *op_ptr = NULL;
int mpi_errno = MPI_SUCCESS;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_OP_COMMUTATIVE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -88,6 +88,7 @@ int MPI_Op_create(MPI_User_function *function, int commute, MPI_Op *op)
static const char FCNAME[] = "MPI_Op_create";
MPID_Op *op_ptr;
int mpi_errno = MPI_SUCCESS;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_OP_CREATE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -58,6 +58,7 @@ int MPI_Op_free(MPI_Op *op)
MPID_Op *op_ptr = NULL;
int in_use;
int mpi_errno = MPI_SUCCESS;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_OP_FREE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -1163,6 +1163,7 @@ int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcnts,
{
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_REDUCE_SCATTER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -1247,7 +1248,6 @@ int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcnts,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -956,6 +956,7 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
#if defined(USE_SMP_COLLECTIVES)
MPIU_CHKLMEM_DECL(1);
#endif
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_REDUCE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -1088,7 +1089,6 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
void *tmp_buf = NULL;
MPI_Aint true_lb, true_extent, extent;
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
/* Create a temporary buffer on local roots of all nodes */
......
......@@ -522,6 +522,7 @@ int MPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
{
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_SCAN);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -596,7 +597,6 @@ int MPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
#if defined(USE_SMP_COLLECTIVES)
......
......@@ -625,6 +625,7 @@ int MPI_Scatter(void *sendbuf, int sendcnt, MPI_Datatype sendtype,
static const char FCNAME[] = "MPI_Scatter";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_SCATTER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -731,7 +732,6 @@ int MPI_Scatter(void *sendbuf, int sendcnt, MPI_Datatype sendtype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -191,6 +191,7 @@ int MPI_Scatterv( void *sendbuf, int *sendcnts, int *displs,
static const char FCNAME[] = "MPI_Scatterv";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_SCATTERV);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -317,7 +318,6 @@ int MPI_Scatterv( void *sendbuf, int *sendcnts, int *displs,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -493,6 +493,7 @@ int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm)
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPID_Group *group_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_CREATE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -80,6 +80,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm)
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL, *newcomm_ptr;
MPID_Attribute *new_attributes = 0;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_DUP);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -68,6 +68,7 @@ int MPI_Comm_free(MPI_Comm *comm)
static const char FCNAME[] = "MPI_Comm_free";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_FREE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -58,6 +58,7 @@ int MPI_Comm_group(MPI_Comm comm, MPI_Group *group)
int i, lpid, n;
MPID_Group *group_ptr;
MPID_VCR *local_vcr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_GROUP);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -60,6 +60,7 @@ int MPI_Comm_remote_group(MPI_Comm comm, MPI_Group *group)
MPID_Comm *comm_ptr = NULL;
int i, lpid, n;
MPID_Group *group_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_REMOTE_GROUP);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment