Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rob Latham
MPICH-BlueGene
Commits
a023ea7b
Commit
a023ea7b
authored
Aug 03, 2010
by
David Goodell
Browse files
[svn-r6981] add the MPI_OBJ CS and associated implementation
No reviewer.
parent
d16830c5
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/include/mpihandlemem.h
View file @
a023ea7b
...
...
@@ -369,8 +369,9 @@ typedef OPA_int_t MPIU_Handle_ref_count;
* MPIU_Object_add_ref and MPIU_Object_release_ref.
*
* NOTE: This macro *must* be invoked as the very first element of the structure! */
#define MPIU_OBJECT_HEADER \
int handle; \
#define MPIU_OBJECT_HEADER \
int handle; \
MPIU_THREAD_OBJECT_HOOK
/*no-semi*/
\
MPIU_Handle_ref_count ref_count
/*semicolon intentionally omitted*/
/* ALL objects have the handle as the first value. */
...
...
src/include/mpiimplthread.h
View file @
a023ea7b
...
...
@@ -53,6 +53,7 @@ enum MPIU_Thread_cs_name {
MPIU_THREAD_CS_NAME_COMPLETION
,
MPIU_THREAD_CS_NAME_PMI
,
MPIU_THREAD_CS_NAME_CONTEXTID
,
MPIU_THREAD_CS_NAME_MPI_OBJ
,
MPIU_THREAD_CS_NAME_MSGQUEUE
,
/* FIXME device-specific, should this live here? */
/*
...
...
@@ -699,6 +700,9 @@ enum MPIU_Nest_mutexes {
* doesn't do anything at ENTER/EXIT? */
#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context) MPIU_THREAD_CS_YIELD_LOCKNAME_CHECKED(global_mutex)
#define MPIU_THREAD_CS_ENTER_MPI_OBJ(context_) do {} while(0)
#define MPIU_THREAD_CS_EXIT_MPI_OBJ(context_) do {} while(0)
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
/* There are multiple locks, one for each (major) object */
...
...
@@ -858,6 +862,37 @@ enum MPIU_Nest_mutexes {
#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context) MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(ctx_mutex)
#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context) MPIU_THREAD_CS_YIELD_LOCKNAME_CHECKED(ctx_mutex)
/* must include semicolon */
#define MPIU_THREAD_OBJECT_HOOK MPID_Thread_mutex_t pobj_mutex;
#define MPIU_THREAD_CS_ENTER_MPI_OBJ(context_) \
do { \
if (MPIU_ISTHREADED) \
MPID_Thread_mutex_lock(&context_->pobj_mutex); \
} while (0)
#define MPIU_THREAD_CS_EXIT_MPI_OBJ(context_) \
do { \
if (MPIU_ISTHREADED) \
MPID_Thread_mutex_unlock(&context_->pobj_mutex); \
} while (0)
/* initialize any per-object mutex in an MPI handle allocated object. Mainly
* provided to reduce the amount of #ifdef/#endif code outside of this file. */
#define MPIU_THREAD_MPI_OBJ_INIT(objptr_) \
do { \
int err_ = 0; \
MPID_Thread_mutex_create(&(objptr_)->pobj_mutex, &err_); \
MPIU_Assert(!err_); \
} while (0)
#define MPIU_THREAD_MPI_OBJ_FINALIZE(objptr_) \
do { \
int err; \
MPID_Thread_mutex_destroy(&(objptr_)->pobj_mutex, &err); \
MPIU_Assert(!err); \
} while (0) \
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
/* Updates to shared data and access to shared services is handled without
locks where ever possible. */
...
...
@@ -875,6 +910,12 @@ enum MPIU_Nest_mutexes {
#define MPIU_THREAD_CS_YIELD(_name,_context)
#endif
/* MPICH_IS_THREADED */
/* catch-all */
#ifndef MPIU_THREAD_OBJECT_HOOK
# define MPIU_THREAD_OBJECT_HOOK
/**/
# define MPIU_THREAD_OBJECT_HOOK_INIT
/**/
#endif
#ifndef MPIU_THREAD_CS_ASSERT_HELD
#define MPIU_THREAD_CS_ASSERT_HELD(name_) do{
/*nothing*/
}while(0)
#define MPIU_THREAD_CS_ASSERT_ENTER_HELPER(name_)
...
...
@@ -1019,6 +1060,12 @@ do { \
} while (0)
#endif
#ifndef MPIU_THREAD_MPI_OBJ_INIT
#define MPIU_THREAD_MPI_OBJ_INIT(objptr_) do {} while (0)
#endif
#ifndef MPIU_THREAD_MPI_OBJ_FINALIZE
#define MPIU_THREAD_MPI_OBJ_FINALIZE(objptr_) do {} while (0)
#endif
#endif
/* !defined(MPIIMPLTHREAD_H_INCLUDED) */
src/mpi/comm/commutil.c
View file @
a023ea7b
...
...
@@ -78,6 +78,8 @@ int MPIR_Comm_init(MPID_Comm *comm_p)
MPIU_Object_set_ref
(
comm_p
,
1
);
MPIU_THREAD_MPI_OBJ_INIT
(
comm_p
);
/* Clear many items (empty means to use the default; some of these
may be overridden within the upper-level communicator initialization) */
comm_p
->
errhandler
=
NULL
;
...
...
src/mpi/datatype/typeutil.c
View file @
a023ea7b
...
...
@@ -266,6 +266,8 @@ int MPIR_Datatype_builtin_fillin(void)
dptr
->
ub
=
dptr
->
size
;
dptr
->
true_ub
=
dptr
->
size
;
dptr
->
contents
=
NULL
;
/* should never get referenced? */
MPIU_THREAD_MPI_OBJ_INIT
(
dptr
);
}
/* --BEGIN ERROR HANDLING-- */
if
(
d
!=
-
1
&&
i
<
sizeof
(
mpi_dtypes
)
/
sizeof
(
*
mpi_dtypes
)
&&
mpi_dtypes
[
i
]
!=
-
1
)
{
...
...
src/mpi/group/grouputil.c
View file @
a023ea7b
...
...
@@ -31,6 +31,9 @@ int MPIR_Group_init(void)
MPID_Group_builtin
[
0
].
idx_of_first_lpid
=
-
1
;
MPID_Group_builtin
[
0
].
lrank_to_lpid
=
NULL
;
/* the mutex is probably never used, but initializing it doesn't hurt */
MPIU_THREAD_MPI_OBJ_INIT
(
&
MPID_Group_builtin
[
0
]);
/* TODO hook for device here? */
return
mpi_errno
;
}
...
...
src/mpid/ch3/include/mpidimpl.h
View file @
a023ea7b
...
...
@@ -742,11 +742,6 @@ typedef struct MPIDI_VC
MPIDI_Comm_ops_t
*
comm_ops
;
#endif
#ifdef MPICH_IS_THREADED
#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
MPID_Thread_mutex_t
pobj_mutex
;
#endif
#endif
/* Rather than have each channel define its own fields for the
channel-specific data, we provide a fixed-sized scratchpad. Currently,
this has a very generous size, though this may shrink later (a channel
...
...
@@ -1200,6 +1195,7 @@ int MPIDI_CH3I_Progress_finalize(void);
} while (0)
#endif
/* The following is part of an implementation of a control of a
resource shared among threads - it needs to be managed more
explicitly as such as shared resource */
...
...
@@ -1209,6 +1205,7 @@ int MPIDI_CH3I_Progress_finalize(void);
MPIDI_CH3I_INCR_PROGRESS_COMPLETION_COUNT; \
}
#else
/* TODO these decls should probably move into each channel as appropriate */
extern
volatile
int
MPIDI_CH3I_progress_blocked
;
extern
volatile
int
MPIDI_CH3I_progress_wakeup_signalled
;
...
...
src/util/mem/handlemem.c
View file @
a023ea7b
...
...
@@ -403,6 +403,9 @@ void *MPIU_Handle_obj_alloc_unsafe(MPIU_Object_alloc_t *objmem)
* annotations instead. */
MPL_VG_ANNOTATE_NEW_MEMORY
(
ptr
,
objmem
->
size
);
/* must come after NEW_MEMORY annotation above to avoid problems */
MPIU_THREAD_MPI_OBJ_INIT
(
ptr
);
MPIU_DBG_MSG_FMT
(
HANDLE
,
TYPICAL
,(
MPIU_DBG_FDEST
,
"Allocating object ptr %p (handle val 0x%08x)"
,
ptr
,
ptr
->
handle
));
...
...
@@ -435,6 +438,8 @@ void MPIU_Handle_obj_free( MPIU_Object_alloc_t *objmem, void *object )
MPIU_Handle_get_kind_str
(
HANDLE_GET_MPI_KIND
((
obj
)
->
handle
)),
MPIU_Object_get_ref
(
obj
)));
MPIU_THREAD_MPI_OBJ_FINALIZE
(
obj
);
MPL_VG_MEMPOOL_FREE
(
objmem
,
obj
);
/* MEMPOOL_FREE marks the object NOACCESS, so we have to make the
* MPIU_Handle_common area that is used for internal book keeping
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment