diff options
author | Determinant <[email protected]> | 2016-02-17 20:14:06 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2016-02-17 20:14:06 +0800 |
commit | 0ee43c21af4fcd3aed070b1f5ad1eb9feb2ad159 (patch) | |
tree | ceb1d38328767fb657bc0d37ec6e513b08a86277 /nerv/matrix | |
parent | 490a10c2130773bd022f05513fa2905b6a6c6e91 (diff) |
try to merge manually
Diffstat (limited to 'nerv/matrix')
-rw-r--r-- | nerv/matrix/cumatrix.c | 9 | ||||
-rw-r--r-- | nerv/matrix/generic/cumatrix.c | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/nerv/matrix/cumatrix.c b/nerv/matrix/cumatrix.c index bf92f92..7f22d68 100644 --- a/nerv/matrix/cumatrix.c +++ b/nerv/matrix/cumatrix.c @@ -8,6 +8,14 @@ static cublasHandle_t cublas_handle; static cudaEvent_t profile_start, profile_stop; static HashMap *profile; +static int select_gpu(lua_State *L) { + Status status; + int dev = luaL_checkinteger(L, 1); + nerv_cumatrix_select_gpu(dev, &status); + NERV_LUA_CHECK_STATUS(L, status); + return 0; +} + static int print_profile(lua_State *L) { nerv_cumatrix_print_profile(); return 0; @@ -21,6 +29,7 @@ static int clear_profile(lua_State *L) { static const luaL_Reg cumatrix_methods[] = { {"print_profile", print_profile}, {"clear_profile", clear_profile}, + {"select_gpu", select_gpu}, {NULL, NULL} }; diff --git a/nerv/matrix/generic/cumatrix.c b/nerv/matrix/generic/cumatrix.c index cb55901..b706c21 100644 --- a/nerv/matrix/generic/cumatrix.c +++ b/nerv/matrix/generic/cumatrix.c @@ -15,6 +15,15 @@ static int nerv_matrix_(lua_get_blas_op)(char ch) { return (ch == 'T' || ch == 't') ? CUBLAS_OP_T : CUBLAS_OP_N; } +static int nerv_matrix_(lua_prefixsum_row)(lua_State *L) { + Status status; + Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname)); + Matrix *b = luaT_checkudata(L, 2, nerv_matrix_(tname)); + nerv_matrix_(prefixsum_row)(a, b, &status); + NERV_LUA_CHECK_STATUS(L, status); + return 0; +} + static int nerv_matrix_(lua_thres_mask)(lua_State *L) { Status status; Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname)); @@ -230,6 +239,7 @@ static const luaL_Reg nerv_matrix_(extra_methods)[] = { {"rearrange_frm", nerv_matrix_(lua_rearrange_frm)}, {"scale_rows_by_row", nerv_matrix_(lua_scale_rows_by_row)}, {"scale_rows_by_col", nerv_matrix_(lua_scale_rows_by_col)}, + {"prefixsum_row", nerv_matrix_(lua_prefixsum_row)}, #ifdef __NERV_FUTURE_CUDA_7 {"update_select_rows_by_rowidx", nerv_matrix_(lua_update_select_rows_by_rowidx)}, {"update_select_rows_by_colidx", nerv_matrix_(lua_update_select_rows_by_colidx)}, |