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
......@@ -172,7 +172,6 @@ int MPIR_Thread_CS_Finalize( void );
*/
#define MPID_CS_ENTER() \
{ \
MPIU_THREADPRIV_DECL; \
MPIU_THREADPRIV_GET; \
if (MPIR_Nest_value() == 0) \
{ \
......@@ -183,7 +182,6 @@ int MPIR_Thread_CS_Finalize( void );
}
#define MPID_CS_EXIT() \
{ \
MPIU_THREADPRIV_DECL; \
MPIU_THREADPRIV_GET; \
if (MPIR_Nest_value() == 0) \
{ \
......@@ -383,7 +381,6 @@ M*/
/* Helper definitions */
#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_GLOBAL
#define MPIU_THREAD_CHECKNEST(_name) \
MPIU_THREADPRIV_DECL; \
MPIU_THREADPRIV_GET; \
if (MPIR_Nest_value() == 0)
......@@ -646,7 +643,7 @@ typedef struct MPIU_ThreadDebug {
#define MPIU_THREAD_CS_EXIT(_name,_context)
#define MPIU_THREAD_CS_YIELD(_name,_context)
#endif /* MPICH_IS_THREADED */
#endif /* !defined(MPID_DEFINES_MPID_CS)a */
#endif /* !defined(MPID_DEFINES_MPID_CS) */
#endif /* !defined(MPIIMPLTHREAD_H_INCLUDED) */
......
......@@ -72,6 +72,7 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
static const char FCNAME[] = "MPI_Comm_create_keyval";
int mpi_errno = MPI_SUCCESS;
MPID_Keyval *keyval_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_CREATE_KEYVAL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -55,6 +55,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
MPID_Comm *comm_ptr = NULL;
MPID_Attribute *p, **old_p;
MPID_Keyval *keyval_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_DELETE_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -55,6 +55,7 @@ int MPI_Comm_free_keyval(int *comm_keyval)
MPID_Keyval *keyval_ptr = NULL;
int in_use;
int mpi_errno = MPI_SUCCESS;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_FREE_KEYVAL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -42,6 +42,7 @@ int MPIR_CommGetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
MPID_Comm *comm_ptr = NULL;
static PreDefined_attrs attr_copy; /* Used to provide a copy of the
predefined attributes */
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_COMM_GET_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -34,6 +34,7 @@ int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
MPID_Comm *comm_ptr = NULL;
MPID_Keyval *keyval_ptr = NULL;
MPID_Attribute *p, **old_p;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_COMM_SET_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -64,6 +64,7 @@ int MPI_Type_create_keyval(MPI_Type_copy_attr_function *type_copy_attr_fn,
static const char FCNAME[] = "MPI_Type_create_keyval";
int mpi_errno = MPI_SUCCESS;
MPID_Keyval *keyval_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_TYPE_CREATE_KEYVAL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -53,6 +53,7 @@ int MPI_Type_delete_attr(MPI_Datatype type, int type_keyval)
MPID_Datatype *type_ptr = NULL;
MPID_Attribute *p, **old_p;
MPID_Keyval *keyval_ptr = 0;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_TYPE_DELETE_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -52,6 +52,7 @@ int MPI_Type_free_keyval(int *type_keyval)
MPID_Keyval *keyval_ptr = NULL;
int in_use;
int mpi_errno = MPI_SUCCESS;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_TYPE_FREE_KEYVAL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -36,6 +36,7 @@ int MPIR_TypeGetAttr( MPI_Datatype type, int type_keyval, void *attribute_val,
int mpi_errno = MPI_SUCCESS;
MPID_Datatype *type_ptr = NULL;
MPID_Attribute *p;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_TYPE_GET_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -34,6 +34,7 @@ int MPIR_TypeSetAttr(MPI_Datatype type, int type_keyval, void *attribute_val,
MPID_Datatype *type_ptr = NULL;
MPID_Keyval *keyval_ptr = NULL;
MPID_Attribute *p, **old_p;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_TYPE_SET_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -64,6 +64,7 @@ int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
static const char FCNAME[] = "MPI_Win_create_keyval";
int mpi_errno = MPI_SUCCESS;
MPID_Keyval *keyval_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_CREATE_KEYVAL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -54,6 +54,7 @@ int MPI_Win_delete_attr(MPI_Win win, int win_keyval)
MPID_Win *win_ptr = NULL;
MPID_Attribute *p, **old_p;
MPID_Keyval *keyval_ptr=0;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_DELETE_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -53,6 +53,7 @@ int MPI_Win_free_keyval(int *win_keyval)
int mpi_errno = MPI_SUCCESS;
MPID_Keyval *keyval_ptr = NULL;
int in_use;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_FREE_KEYVAL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -34,6 +34,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
#endif
int mpi_errno = MPI_SUCCESS;
MPID_Win *win_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_WIN_GET_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -34,6 +34,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
MPID_Win *win_ptr = NULL;
MPID_Keyval *keyval_ptr = NULL;
MPID_Attribute *p, **old_p;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_WIN_SET_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -752,6 +752,7 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
{
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ALLGATHER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -826,7 +827,6 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -1020,6 +1020,7 @@ int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
static const char FCNAME[] = "MPI_Allgatherv";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ALLGATHERV);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -1106,7 +1107,6 @@ int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -599,6 +599,7 @@ int MPI_Allreduce ( void *sendbuf, void *recvbuf, int count,
static const char FCNAME[] = "MPI_Allreduce";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ALLREDUCE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -731,7 +732,6 @@ int MPI_Allreduce ( void *sendbuf, void *recvbuf, int count,
/* now broadcast the result among local processes */
if (comm_ptr->node_comm != NULL) {
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
......@@ -658,6 +658,7 @@ int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
static const char FCNAME[] = "MPI_Alltoall";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ALLTOALL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -727,7 +728,6 @@ int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
}
else
{
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
......
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