Skip to content

Commit

Permalink
Merged in kaushikggg/petsc4py (pull request #127)
Browse files Browse the repository at this point in the history
VecCUDA(Get/Restore)ArrayReadWrite -> VecCUDA(Get/Restore)Array
  • Loading branch information
kaushikggg authored and dalcinl committed Jul 25, 2019
2 parents 054bb74 + a95c801 commit 30a1bbd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/PETSc/Vec.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ cdef class Vec(Object):
cdef const_char *m = NULL
if mode is not None: mode = str2bytes(mode, &m)
if m == NULL or (m[0] == c'r' and m[1] == c'w'):
CHKERR( VecCUDAGetArrayReadWrite(self.vec, &hdl) )
CHKERR( VecCUDAGetArray(self.vec, &hdl) )
elif m[0] == c'r':
CHKERR( VecCUDAGetArrayRead(self.vec, <const_PetscScalar**>&hdl) )
elif m[0] == c'w':
Expand All @@ -409,7 +409,7 @@ cdef class Vec(Object):
cdef const_char *m = NULL
if mode is not None: mode = str2bytes(mode, &m)
if m == NULL or (m[0] == c'r' and m[1] == c'w'):
CHKERR( VecCUDARestoreArrayReadWrite(self.vec, &hdl) )
CHKERR( VecCUDARestoreArray(self.vec, &hdl) )
elif m[0] == c'r':
CHKERR( VecCUDARestoreArrayRead(self.vec, <const_PetscScalar**>&hdl) )
elif m[0] == c'w':
Expand Down
4 changes: 2 additions & 2 deletions src/PETSc/petscvec.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ cdef extern from * nogil:

int VecCUDAGetArrayRead(PetscVec,const_PetscScalar*[])
int VecCUDAGetArrayWrite(PetscVec,PetscScalar*[])
int VecCUDAGetArrayReadWrite(PetscVec,PetscScalar*[])
int VecCUDAGetArray(PetscVec,PetscScalar*[])
int VecCUDARestoreArrayRead(PetscVec,const_PetscScalar*[])
int VecCUDARestoreArrayWrite(PetscVec,PetscScalar*[])
int VecCUDARestoreArrayReadWrite(PetscVec,PetscScalar*[])
int VecCUDARestoreArray(PetscVec,PetscScalar*[])

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

Expand Down
6 changes: 2 additions & 4 deletions src/include/custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ PetscLogEventGetPerfInfo(int stage,PetscLogEvent event,PetscEventPerfInfo *info)

PETSC_EXTERN PetscErrorCode VecCUDAGetArrayRead(Vec,const PetscScalar**);
PETSC_EXTERN PetscErrorCode VecCUDAGetArrayWrite(Vec,PetscScalar**);
PETSC_EXTERN PetscErrorCode VecCUDAGetArrayReadWrite(Vec,PetscScalar**);
PETSC_EXTERN PetscErrorCode VecCUDAGetArray(Vec,PetscScalar**);

PETSC_EXTERN PetscErrorCode VecCUDARestoreArrayRead(Vec,const PetscScalar**);
PETSC_EXTERN PetscErrorCode VecCUDARestoreArrayWrite(Vec,PetscScalar**);
PETSC_EXTERN PetscErrorCode VecCUDARestoreArrayReadWrite(Vec,PetscScalar**);
PETSC_EXTERN PetscErrorCode VecCUDARestoreArray(Vec,PetscScalar**);

#else

Expand All @@ -182,7 +182,6 @@ VecCUDAGetArray(Vec v,PetscScalar **a)
}
#define VecCUDAGetArrayRead(v,a) VecCUDAGetArray(v,(PetscScalar**)(a))
#define VecCUDAGetArrayWrite VecCUDAGetArray
#define VecCUDAGetArrayReadWrite VecCUDAGetArray

PETSC_STATIC_INLINE PetscErrorCode
VecCUDARestoreArray(Vec v,PetscScalar **a)
Expand All @@ -196,7 +195,6 @@ VecCUDARestoreArray(Vec v,PetscScalar **a)
}
#define VecCUDARestoreArrayRead(v,a) VecCUDARestoreArray(v,(PetscScalar**)(a))
#define VecCUDARestoreArrayWrite VecCUDARestoreArray
#define VecCUDARestoreArrayReadWrite VecCUDARestoreArray

#endif

Expand Down

0 comments on commit 30a1bbd

Please sign in to comment.