diff options
Diffstat (limited to 'nerv/nerv')
-rw-r--r-- | nerv/nerv | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -24,15 +24,16 @@ local function _add_profile_method(cls) end if not opts["use-cpu"].val then + local dev = -1 + if opts["select-gpu"].val then + dev = opts["select-gpu"].val + end nerv.info("automatically initialize a default CuContext...") - nerv.CuMatrix._default_context = nerv.CuContext() + nerv.CuMatrix._default_context = nerv.CuContext(dev) nerv.info("the default CuContext is ok") _add_profile_method(nerv.CuMatrix) nerv.CuMatrix.select_gpu = function (dev) nerv.CuMatrix._default_context:select_gpu(dev) end - if opts["select-gpu"].val then - nerv.CuMatrix.select_gpu(opts["select-gpu"].val) - end end nerv.info("automatically initialize a default MContext...") |