aboutsummaryrefslogtreecommitdiff
path: root/nerv/matrix/cumatrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'nerv/matrix/cumatrix.c')
-rw-r--r--nerv/matrix/cumatrix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nerv/matrix/cumatrix.c b/nerv/matrix/cumatrix.c
index 7d10895..b8eef9c 100644
--- a/nerv/matrix/cumatrix.c
+++ b/nerv/matrix/cumatrix.c
@@ -26,7 +26,8 @@ int nerv_cuda_context_lua_clear_profile(lua_State *L) {
int nerv_cuda_context_lua_new(lua_State *L) {
Status status;
- CuContext *self = nerv_cuda_context_create(&status);
+ int dev = lua_gettop(L) > 0 ? luaL_checkinteger(L, 1) : -1;
+ CuContext *self = nerv_cuda_context_create(dev, &status);
NERV_LUA_CHECK_STATUS(L, status);
luaT_pushudata(L, self, nerv_cuda_context_tname);
return 1;