Skip to content

Commit

Permalink
Merge branch release-1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Feb 1, 2012
2 parents eac3d36 + 1e668be commit b093cec
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 122 deletions.
94 changes: 54 additions & 40 deletions src/MPI/commimpl.pxi
Expand Up @@ -12,12 +12,13 @@ cdef int comm_keyval_del(int keyval) except -1:
except KeyError: pass
return 0

cdef int comm_attr_copy(MPI_Comm comm,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) except -1:
cdef int comm_attr_copy(
MPI_Comm comm,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) except -1:
cdef tuple entry = comm_keyval.get(keyval)
cdef object copy_fn = None
if entry is not None: copy_fn = entry[0]
Expand All @@ -33,31 +34,13 @@ cdef int comm_attr_copy(MPI_Comm comm,
flag[0] = 1
return 0

cdef int comm_attr_delete(MPI_Comm comm,
int keyval,
void *attrval,
void *extra_state) except -1:
cdef tuple entry = comm_keyval.get(keyval)
cdef object delete_fn = None
if entry is not None: delete_fn = entry[1]
if delete_fn is not None:
delete_fn(<object>attrval)
Py_DECREF(<object>attrval)
return 0

@cython.callspec("PyMPIAPI")
cdef int comm_attr_copy_fn(MPI_Comm comm,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) with gil:
if not Py_IsInitialized():
return MPI_SUCCESS
if attrval_in == NULL:
return MPI_ERR_INTERN
if attrval_out == NULL:
return MPI_ERR_INTERN
cdef int comm_attr_copy_cb(
MPI_Comm comm,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) with gil:
cdef object exc
try:
comm_attr_copy(comm, keyval, extra_state,
Expand All @@ -70,15 +53,24 @@ cdef int comm_attr_copy_fn(MPI_Comm comm,
return MPI_ERR_OTHER
return MPI_SUCCESS

@cython.callspec("PyMPIAPI")
cdef int comm_attr_delete_fn(MPI_Comm comm,
int keyval,
void *attrval,
void *extra_state) with gil:
if not Py_IsInitialized():
return MPI_SUCCESS
if attrval == NULL:
return MPI_ERR_INTERN
cdef int comm_attr_delete(
MPI_Comm comm,
int keyval,
void *attrval,
void *extra_state) except -1:
cdef tuple entry = comm_keyval.get(keyval)
cdef object delete_fn = None
if entry is not None: delete_fn = entry[1]
if delete_fn is not None:
delete_fn(<object>attrval)
Py_DECREF(<object>attrval)
return 0

cdef int comm_attr_delete_cb(
MPI_Comm comm,
int keyval,
void *attrval,
void *extra_state) with gil:
cdef object exc
try:
comm_attr_delete(comm, keyval, attrval, extra_state)
Expand All @@ -90,6 +82,28 @@ cdef int comm_attr_delete_fn(MPI_Comm comm,
return MPI_ERR_OTHER
return MPI_SUCCESS

@cython.callspec("PyMPIAPI")
cdef int comm_attr_copy_fn(MPI_Comm comm,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) nogil:
if attrval_in == NULL: return MPI_ERR_INTERN
if attrval_out == NULL: return MPI_ERR_INTERN
if not Py_IsInitialized(): return MPI_SUCCESS
return comm_attr_copy_cb(comm, keyval, extra_state,
attrval_in, attrval_out, flag)

@cython.callspec("PyMPIAPI")
cdef int comm_attr_delete_fn(MPI_Comm comm,
int keyval,
void *attrval,
void *extra_state) nogil:
if attrval == NULL: return MPI_ERR_INTERN
if not Py_IsInitialized(): return MPI_SUCCESS
return comm_attr_delete_cb(comm, keyval, attrval, extra_state)

# -----------------------------------------------------------------------------

cdef _p_buffer _buffer = None
Expand Down
94 changes: 54 additions & 40 deletions src/MPI/typeimpl.pxi
Expand Up @@ -12,12 +12,13 @@ cdef inline int type_keyval_del(int keyval) except -1:
except KeyError: pass
return 0

cdef inline int type_attr_copy(MPI_Datatype datatype,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) except -1:
cdef inline int type_attr_copy(
MPI_Datatype datatype,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) except -1:
cdef tuple entry = type_keyval.get(keyval)
cdef object copy_fn = None
if entry is not None: copy_fn = entry[0]
Expand All @@ -33,31 +34,13 @@ cdef inline int type_attr_copy(MPI_Datatype datatype,
flag[0] = 1
return 0

cdef inline int type_attr_delete(MPI_Datatype datatype,
int keyval,
void *attrval,
void *extra_state) except -1:
cdef tuple entry = type_keyval.get(keyval)
cdef object delete_fn = None
if entry is not None: delete_fn = entry[1]
if delete_fn is not None:
delete_fn(<object>attrval)
Py_DECREF(<object>attrval)
return 0

@cython.callspec("PyMPIAPI")
cdef int type_attr_copy_fn(MPI_Datatype datatype,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) with gil:
if not Py_IsInitialized():
return MPI_SUCCESS
if attrval_in == NULL:
return MPI_ERR_INTERN
if attrval_out == NULL:
return MPI_ERR_INTERN
cdef int type_attr_copy_cb(
MPI_Datatype datatype,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) with gil:
cdef object exc
try:
type_attr_copy(datatype, keyval, extra_state,
Expand All @@ -70,15 +53,24 @@ cdef int type_attr_copy_fn(MPI_Datatype datatype,
return MPI_ERR_OTHER
return MPI_SUCCESS

@cython.callspec("PyMPIAPI")
cdef int type_attr_delete_fn(MPI_Datatype datatype,
int keyval,
void *attrval,
void *extra_state) with gil:
if not Py_IsInitialized():
return MPI_SUCCESS
if attrval == NULL:
return MPI_ERR_INTERN
cdef inline int type_attr_delete(
MPI_Datatype datatype,
int keyval,
void *attrval,
void *extra_state) except -1:
cdef tuple entry = type_keyval.get(keyval)
cdef object delete_fn = None
if entry is not None: delete_fn = entry[1]
if delete_fn is not None:
delete_fn(<object>attrval)
Py_DECREF(<object>attrval)
return 0

cdef int type_attr_delete_cb(
MPI_Datatype datatype,
int keyval,
void *attrval,
void *extra_state) with gil:
cdef object exc
try:
type_attr_delete(datatype, keyval, attrval, extra_state)
Expand All @@ -90,4 +82,26 @@ cdef int type_attr_delete_fn(MPI_Datatype datatype,
return MPI_ERR_OTHER
return MPI_SUCCESS

@cython.callspec("PyMPIAPI")
cdef int type_attr_copy_fn(MPI_Datatype datatype,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) nogil:
if attrval_in == NULL: return MPI_ERR_INTERN
if attrval_out == NULL: return MPI_ERR_INTERN
if not Py_IsInitialized(): return MPI_SUCCESS
return type_attr_copy_cb(datatype, keyval, extra_state,
attrval_in, attrval_out, flag)

@cython.callspec("PyMPIAPI")
cdef int type_attr_delete_fn(MPI_Datatype datatype,
int keyval,
void *attrval,
void *extra_state) nogil:
if attrval == NULL: return MPI_ERR_INTERN
if not Py_IsInitialized(): return MPI_SUCCESS
return type_attr_delete_cb(datatype, keyval, attrval, extra_state)

# -----------------------------------------------------------------------------
98 changes: 56 additions & 42 deletions src/MPI/winimpl.pxi
Expand Up @@ -42,12 +42,13 @@ cdef inline int win_keyval_del(int keyval) except -1:
except KeyError: pass
return 0

cdef inline int win_attr_copy(MPI_Win win,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) except -1:
cdef int win_attr_copy(
MPI_Win win,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) except -1:
cdef tuple entry = win_keyval.get(keyval)
cdef object copy_fn = None
if entry is not None: copy_fn = entry[0]
Expand All @@ -63,61 +64,74 @@ cdef inline int win_attr_copy(MPI_Win win,
flag[0] = 1
return 0

cdef inline int win_attr_delete(MPI_Win win,
int keyval,
void *attrval,
void *extra_state) except -1:
cdef tuple entry = win_keyval.get(keyval)
cdef object delete_fn = None
if entry is not None: delete_fn = entry[1]
if delete_fn is not None:
delete_fn(<object>attrval)
Py_DECREF(<object>attrval)
return 0

@cython.callspec("PyMPIAPI")
cdef int win_attr_copy_fn(MPI_Win win,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) with gil:
if not Py_IsInitialized():
return MPI_SUCCESS
if attrval_in == NULL:
return MPI_ERR_INTERN
if attrval_out == NULL:
return MPI_ERR_INTERN
cdef int win_attr_copy_cb(
MPI_Win win,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) with gil:
cdef object exc
try:
win_attr_copy(win, keyval, extra_state,
attrval_in, attrval_out, flag)
except MPIException, exc:
except MPIException as exc:
print_traceback()
return exc.Get_error_code()
except:
print_traceback()
return MPI_ERR_OTHER
return MPI_SUCCESS

@cython.callspec("PyMPIAPI")
cdef int win_attr_delete_fn(MPI_Win win,
int keyval,
void *attrval,
void *extra_state) with gil:
if not Py_IsInitialized():
return MPI_SUCCESS
if attrval == NULL:
return MPI_ERR_INTERN
cdef int win_attr_delete(
MPI_Win win,
int keyval,
void *attrval,
void *extra_state) except -1:
cdef tuple entry = win_keyval.get(keyval)
cdef object delete_fn = None
if entry is not None: delete_fn = entry[1]
if delete_fn is not None:
delete_fn(<object>attrval)
Py_DECREF(<object>attrval)
return 0

cdef int win_attr_delete_cb(
MPI_Win win,
int keyval,
void *attrval,
void *extra_state) with gil:
cdef object exc
try:
win_attr_delete(win, keyval, attrval, extra_state)
except MPIException, exc:
except MPIException as exc:
print_traceback()
return exc.Get_error_code()
except:
print_traceback()
return MPI_ERR_OTHER
return MPI_SUCCESS

@cython.callspec("PyMPIAPI")
cdef int win_attr_copy_fn(MPI_Win win,
int keyval,
void *extra_state,
void *attrval_in,
void *attrval_out,
int *flag) nogil:
if attrval_in == NULL: return MPI_ERR_INTERN
if attrval_out == NULL: return MPI_ERR_INTERN
if not Py_IsInitialized(): return MPI_SUCCESS
return win_attr_copy_cb(win, keyval, extra_state,
attrval_in, attrval_out, flag)

@cython.callspec("PyMPIAPI")
cdef int win_attr_delete_fn(MPI_Win win,
int keyval,
void *attrval,
void *extra_state) nogil:
if attrval == NULL: return MPI_ERR_INTERN
if not Py_IsInitialized(): return MPI_SUCCESS
return win_attr_delete_cb(win, keyval, attrval, extra_state)

# -----------------------------------------------------------------------------

0 comments on commit b093cec

Please sign in to comment.