Commit 2ce5a7e2 authored by Pavan Balaji's avatar Pavan Balaji
Browse files

Prioritize thread-multiple branch.



Give a "likely" attribute to the branch that checks if an MPI process
is initialized in THREAD_MULTIPLE or not.  This should reduce the cost
of the branch for applications that require THREAD_MULTIPLE.

The per-object mode in the pamid branch is intended for the case where
comm-threads are used.  In this case, the application is mostly in
THREAD_MULTIPLE mode, even if it didn't explicitly initialize it as
such.  The only time it'll not be in that mode is during
initialization before the appropriate mutexes have been setup.

See #1900.
Signed-off-by: default avatarMichael Blocksome <blocksom@us.ibm.com>
Signed-off-by: Rob Latham's avatarRob Latham <robl@mcs.anl.gov>
parent 1a0c3dbc
......@@ -107,45 +107,45 @@
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
#define MPIDI_CS_ENTER(m) \
do { \
MPIU_THREAD_CHECK_BEGIN \
MPIDI_Mutex_acquire(m); \
MPIU_THREAD_CHECK_END \
#define MPIDI_CS_ENTER(m) \
do { \
if (likely(MPIR_ThreadInfo.isThreaded)) { \
MPIDI_Mutex_acquire(m); \
} \
} while (0)
#define MPIDI_CS_EXIT(m) \
do { \
MPIU_THREAD_CHECK_BEGIN \
MPIDI_Mutex_sync(); \
MPIDI_Mutex_release(m); \
MPIU_THREAD_CHECK_END \
#define MPIDI_CS_EXIT(m) \
do { \
if (likely(MPIR_ThreadInfo.isThreaded)) { \
MPIDI_Mutex_sync(); \
MPIDI_Mutex_release(m); \
} \
} while (0)
#define MPIDI_CS_YIELD(m) \
do { \
MPIU_THREAD_CHECK_BEGIN \
MPIDI_Mutex_sync(); \
MPIDI_Mutex_release(m); \
MPIDI_Mutex_acquire(m); \
MPIU_THREAD_CHECK_END \
#define MPIDI_CS_YIELD(m) \
do { \
if (likely(MPIR_ThreadInfo.isThreaded)) { \
MPIDI_Mutex_sync(); \
MPIDI_Mutex_release(m); \
MPIDI_Mutex_acquire(m); \
} \
} while (0)
#define MPIDI_CS_TRY(m) \
do { \
MPIU_THREAD_CHECK_BEGIN \
MPIDI_Mutex_try_acquire(m); \
MPIU_THREAD_CHECK_END \
#define MPIDI_CS_TRY(m) \
do { \
if (likely(MPIR_ThreadInfo.isThreaded)) { \
MPIDI_Mutex_try_acquire(m); \
} \
} while (0)
#define MPIDI_CS_SCHED_YIELD(m) \
do { \
MPIU_THREAD_CHECK_BEGIN \
MPIDI_Mutex_sync(); \
MPIDI_Mutex_release(m); \
sched_yield(); \
MPIDI_Mutex_acquire(m); \
MPIU_THREAD_CHECK_END \
#define MPIDI_CS_SCHED_YIELD(m) \
do { \
if (likely(MPIR_ThreadInfo.isThreaded)) { \
MPIDI_Mutex_sync(); \
MPIDI_Mutex_release(m); \
sched_yield(); \
MPIDI_Mutex_acquire(m); \
} \
} while (0)
#define MPIU_THREAD_CS_ALLFUNC_ENTER(_context)
......
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