-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump version, merge pull request #42 from AMYPAD/clean-api
- Loading branch information
Showing
27 changed files
with
333 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
/** | ||
* SWIG template header wrapping `SwigCuVec<T>` as defined in "cuvec.cuh" | ||
* SWIG template header wrapping `NDCuVec<T>` as defined in "cuvec.cuh" | ||
* for external use via `%include "cuvec.i"`. | ||
*/ | ||
%include "std_vector.i" | ||
%{ | ||
#include "cuvec.cuh" // SwigCuVec<T> | ||
#include "cuvec.cuh" // NDCuVec<T> | ||
%} | ||
/// expose definitions | ||
template <class T> struct SwigCuVec { | ||
template <class T> struct NDCuVec { | ||
CuVec<T> vec; | ||
std::vector<size_t> shape; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "cuvec_cpython.cuh" // deprecated alias |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
%module cuvec_swig | ||
|
||
%include "exception.i" | ||
%exception { | ||
try { | ||
$action | ||
} catch (const std::exception &e) { | ||
SWIG_exception(SWIG_RuntimeError, e.what()); | ||
} | ||
} | ||
|
||
%include "cuvec.i" // NDCuVec<T> | ||
|
||
%{ | ||
template <class T> NDCuVec<T> *NDCuVec_new(std::vector<size_t> shape) { | ||
NDCuVec<T> *self = new NDCuVec<T>(shape); | ||
return self; | ||
} | ||
template <class T> void NDCuVec_del(NDCuVec<T> *self) { | ||
delete self; | ||
} | ||
template <class T> size_t NDCuVec_address(NDCuVec<T> *self) { | ||
return (size_t)self->vec.data(); | ||
} | ||
template <class T> std::vector<size_t> NDCuVec_shape(NDCuVec<T> *self) { return self->shape; } | ||
template <class T> void NDCuVec_reshape(NDCuVec<T> *self, const std::vector<size_t> &shape) { | ||
self->reshape(shape); | ||
} | ||
%} | ||
template <class T> NDCuVec<T> *NDCuVec_new(std::vector<size_t> shape); | ||
template <class T> void NDCuVec_del(NDCuVec<T> *self); | ||
template <class T> size_t NDCuVec_address(NDCuVec<T> *self); | ||
template <class T> std::vector<size_t> NDCuVec_shape(NDCuVec<T> *self); | ||
template <class T> void NDCuVec_reshape(NDCuVec<T> *self, const std::vector<size_t> &shape); | ||
|
||
%template(NDCuVec_Shape) std::vector<size_t>; | ||
%define MKCUVEC(T, typechar) | ||
%template(NDCuVec_ ## typechar) NDCuVec<T>; | ||
%template(NDCuVec_ ## typechar ## _new) NDCuVec_new<T>; | ||
%template(NDCuVec_ ## typechar ## _del) NDCuVec_del<T>; | ||
%template(NDCuVec_ ## typechar ## _address) NDCuVec_address<T>; | ||
%template(NDCuVec_ ## typechar ## _shape) NDCuVec_shape<T>; | ||
%template(NDCuVec_ ## typechar ## _reshape) NDCuVec_reshape<T>; | ||
%enddef | ||
MKCUVEC(signed char, b) | ||
MKCUVEC(unsigned char, B) | ||
MKCUVEC(char, c) | ||
MKCUVEC(short, h) | ||
MKCUVEC(unsigned short, H) | ||
MKCUVEC(int, i) | ||
MKCUVEC(unsigned int, I) | ||
MKCUVEC(long long, q) | ||
MKCUVEC(unsigned long long, Q) | ||
#ifdef _CUVEC_HALF | ||
MKCUVEC(_CUVEC_HALF, e) | ||
#endif | ||
MKCUVEC(float, f) | ||
MKCUVEC(double, d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.