diff options
author | Determinant <ted.sybil@gmail.com> | 2016-02-24 16:58:32 +0800 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2016-02-24 16:58:32 +0800 |
commit | e91fc2ddaa74dd2c46ce93c9e92020d66c037c8e (patch) | |
tree | 94165c3c81b1af93e9b77b408372c0d9ff23dd6b /nerv/nerv | |
parent | 9642bd16922b288c81dee25f17373466ae6888c4 (diff) |
add CuContext/MContextwrapped-handles
Diffstat (limited to 'nerv/nerv')
-rw-r--r-- | nerv/nerv | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -1,6 +1,24 @@ #! /usr/bin/env luajit require 'nerv' -print("Greetings") +nerv.printf("*** NERV: A Lua-based toolkit for high-performance deep learning (alpha) ***\n") +nerv.info("automatically initialize a default CuContext...") +nerv.CuMatrix._default_context = nerv.CuContext() +nerv.info("the default CuContext is ok") + +nerv.info("automatically initialize a default MContext...") +nerv.MMatrix._default_context = nerv.MContext() +nerv.info("the default MContext is ok") + +-- only for backward compatibilty, will be removed in the future +local function _add_profile_method(cls) + local c = cls._default_context + cls.print_profile = function () c:print_profile() end + cls.clear_profile = function () c:clear_profile() end +end +_add_profile_method(nerv.CuMatrix) +_add_profile_method(nerv.MMatrix) + + if #arg < 1 then return end @@ -11,3 +29,5 @@ for i = 2, #arg do end arg = script_arg dofile(script) +nerv.CuMatrix.print_profile() +nerv.MMatrix.print_profile() |