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
......@@ -50,6 +50,7 @@ int MPI_File_create_errhandler(MPI_File_errhandler_fn *function,
static const char FCNAME[] = "MPI_File_create_errhandler";
int mpi_errno = MPI_SUCCESS;
MPID_Errhandler *errhan_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_FILE_CREATE_ERRHANDLER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -58,6 +58,7 @@ int MPI_File_get_errhandler(MPI_File file, MPI_Errhandler *errhandler)
MPI_Errhandler eh;
MPID_Errhandler *e;
#endif
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_FILE_GET_ERRHANDLER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -52,6 +52,7 @@ int MPI_Win_create_errhandler(MPI_Win_errhandler_fn *function,
static const char FCNAME[] = "MPI_Win_create_errhandler";
int mpi_errno = MPI_SUCCESS;
MPID_Errhandler *errhan_ptr;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_CREATE_ERRHANDLER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -53,6 +53,7 @@ int MPI_Win_get_errhandler(MPI_Win win, MPI_Errhandler *errhandler)
#endif
int mpi_errno = MPI_SUCCESS;
MPID_Win *win_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_GET_ERRHANDLER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -60,6 +60,7 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
MPID_Group *group_ptr1 = NULL;
MPID_Group *group_ptr2 = NULL;
int g1_idx, g2_idx, size, i;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_COMPARE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -62,6 +62,7 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup
MPID_Group *group_ptr2 = NULL;
MPID_Group *new_group_ptr;
int size1, i, k, g1_idx, g2_idx, l1_pid, l2_pid, nnew;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_DIFFERENCE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -67,6 +67,7 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group *newgroup)
int mpi_errno = MPI_SUCCESS;
MPID_Group *group_ptr = NULL, *new_group_ptr;
int size, i, newi;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_EXCL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -52,7 +52,7 @@ int MPI_Group_free(MPI_Group *group)
static const char FCNAME[] = "MPI_Group_free";
int mpi_errno = MPI_SUCCESS;
MPID_Group *group_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_FREE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -63,6 +63,7 @@ int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *newgroup)
int mpi_errno = MPI_SUCCESS;
MPID_Group *group_ptr = NULL, *new_group_ptr = NULL;
int i;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_INCL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -64,6 +64,7 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2, MPI_Group *newgro
MPID_Group *group_ptr2 = NULL;
MPID_Group *new_group_ptr;
int size1, i, k, g1_idx, g2_idx, l1_pid, l2_pid, nnew;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_INTERSECTION);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -70,6 +70,7 @@ int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
int mpi_errno = MPI_SUCCESS;
MPID_Group *group_ptr = NULL, *new_group_ptr;
int size, i, j, k, nnew, first, last, stride;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_RANGE_EXCL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -65,6 +65,7 @@ int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
int mpi_errno = MPI_SUCCESS;
MPID_Group *group_ptr = NULL, *new_group_ptr;
int first, last, stride, nnew, i, j, k;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_RANGE_INCL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -63,6 +63,7 @@ int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
MPID_Group *group_ptr1 = NULL;
MPID_Group *group_ptr2 = NULL;
int i, g2_idx, l1_pid, l2_pid;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_TRANSLATE_RANKS);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -59,6 +59,7 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup)
MPID_Group *group_ptr2 = NULL;
MPID_Group *new_group_ptr;
int g1_idx, g2_idx, nnew, i, k, size1, size2, mylpid;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GROUP_UNION);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -60,6 +60,7 @@ int MPI_Abort(MPI_Comm comm, int errorcode)
/* FIXME: 100 is arbitrary and may not be long enough */
char abort_str[100], comm_name[MPI_MAX_OBJECT_NAME];
int len = MPI_MAX_OBJECT_NAME;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ABORT);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -117,6 +117,7 @@ int MPI_Finalize( void )
#if defined(HAVE_USLEEP) && defined(USE_COVERAGE)
int rank=0;
#endif
MPIU_THREADPRIV_DECL;
MPID_MPI_FINALIZE_STATE_DECL(MPID_STATE_MPI_FINALIZE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -220,8 +221,6 @@ int MPI_Finalize( void )
parmFound = MPIU_GetEnvBool( "MPICH_NESTCHECK", &parmValue );
if (!parmFound) parmValue = 1;
if (parmValue) {
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
/* Check for an error in the nesting level */
if (MPIR_Nest_value()) {
......
......@@ -70,6 +70,7 @@ int MPI_Init( int *argc, char ***argv )
int mpi_errno = MPI_SUCCESS;
int rc;
int threadLevel;
MPIU_THREADPRIV_DECL;
MPID_MPI_INIT_STATE_DECL(MPID_STATE_MPI_INIT);
rc = MPID_Wtime_init();
......
......@@ -503,6 +503,7 @@ int MPI_Init_thread( int *argc, char ***argv, int required, int *provided )
static const char FCNAME[] = "MPI_Init_thread";
int mpi_errno = MPI_SUCCESS;
int rc;
MPIU_THREADPRIV_DECL;
MPID_MPI_INIT_STATE_DECL(MPID_STATE_MPI_INIT_THREAD);
rc = MPID_Wtime_init();
......
......@@ -90,6 +90,7 @@ int MPI_Bsend(void *buf, int count, MPI_Datatype datatype, int dest, int tag,
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPID_Request *request_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_BSEND);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......
......@@ -63,6 +63,7 @@ int MPI_Bsend_init(void *buf, int count, MPI_Datatype datatype,
int mpi_errno = MPI_SUCCESS;
MPID_Request *request_ptr = NULL;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_BSEND_INIT);
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