diff options
author | Determinant <ted.sybil@gmail.com> | 2016-03-02 16:49:33 +0800 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2016-03-02 16:49:33 +0800 |
commit | d3abc6459a776ff7fa3777f4f561bc4f5d5e2075 (patch) | |
tree | a0fffbdb4960ba463f720436ca5f050f0d747504 /nerv/matrix | |
parent | 75108e2e000f4382129d453c0fa9073b14d32f97 (diff) |
add GPU auto selection
Diffstat (limited to 'nerv/matrix')
-rw-r--r-- | nerv/matrix/cumatrix.c | 3 |
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; |