aboutsummaryrefslogtreecommitdiff
path: root/nerv/nerv
diff options
context:
space:
mode:
Diffstat (limited to 'nerv/nerv')
-rw-r--r--nerv/nerv11
1 files changed, 4 insertions, 7 deletions
diff --git a/nerv/nerv b/nerv/nerv
index 0b75a9b..f73d517 100644
--- a/nerv/nerv
+++ b/nerv/nerv
@@ -1,8 +1,8 @@
#! /usr/bin/env luajit
require 'nerv'
-local options = {{"help", "h", "bool", default = false, desc = "print this help message"},
- {"use-cpu", "c", "bool", default = false, desc = "use CPU by default (instead of gpu by default)"},
- {"select-gpu", nil, "int", default = nil, desc = "select the GPU for computation, fallback to auto mode if not specified"}}
+local options = {{"help", "h", "boolean", default = false, desc = "print this help message"},
+ {"use-cpu", "c", "boolean", default = false, desc = "use CPU by default (instead of gpu by default)"},
+ {"select-gpu", nil, "int", default = -1, desc = "select the GPU for computation, fallback to auto mode if not specified"}}
local function print_help()
nerv.printf("Usage: <nerv_prog> [options] script.lua\n")
@@ -24,10 +24,7 @@ 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
+ local dev = opts["select-gpu"].val
nerv.info("automatically initialize a default CuContext...")
nerv.CuMatrix._default_context = nerv.CuContext(dev)
nerv.info("the default CuContext is ok")