aboutsummaryrefslogtreecommitdiff
path: root/nerv/nerv
diff options
context:
space:
mode:
Diffstat (limited to 'nerv/nerv')
-rw-r--r--nerv/nerv4
1 files changed, 4 insertions, 0 deletions
diff --git a/nerv/nerv b/nerv/nerv
index f73d517..4c20ec7 100644
--- a/nerv/nerv
+++ b/nerv/nerv
@@ -3,6 +3,7 @@ require 'nerv'
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"}}
+econf = {} -- environment configuration
local function print_help()
nerv.printf("Usage: <nerv_prog> [options] script.lua\n")
@@ -31,6 +32,9 @@ if not opts["use-cpu"].val then
_add_profile_method(nerv.CuMatrix)
nerv.CuMatrix.select_gpu =
function (dev) nerv.CuMatrix._default_context:select_gpu(dev) end
+ econf.use_cpu = false
+else
+ econf.use_cpu = true
end
nerv.info("automatically initialize a default MContext...")