aboutsummaryrefslogtreecommitdiff
path: root/nerv/matrix/cumatrix.c
diff options
context:
space:
mode:
authortxh18 <cloudygooseg@gmail.com>2016-01-29 20:25:09 +0800
committertxh18 <cloudygooseg@gmail.com>2016-01-29 20:25:09 +0800
commitb99fe996dedccada79772d0a061d6b47e54899dd (patch)
tree0f1d9d050f0032008650d2468bc70b906143ebff /nerv/matrix/cumatrix.c
parent3f84267f9fe035ac7ed305a7d66ecab9f7ae50e3 (diff)
select gpu code from mfy
Diffstat (limited to 'nerv/matrix/cumatrix.c')
-rw-r--r--nerv/matrix/cumatrix.c9
1 files changed, 9 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}
};