diff options
-rw-r--r-- | nerv/examples/network_debug/reader.lua | 4 | ||||
-rw-r--r-- | nerv/lib/matrix/cumatrix.c | 6 | ||||
-rw-r--r-- | nerv/lib/matrix/mmatrix.c | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/nerv/examples/network_debug/reader.lua b/nerv/examples/network_debug/reader.lua index 70c0c97..76a78cf 100644 --- a/nerv/examples/network_debug/reader.lua +++ b/nerv/examples/network_debug/reader.lua @@ -32,8 +32,8 @@ end function Reader:get_seq(input_file) local f = io.open(input_file, 'r') self.seq = {} - -- while true do - for i = 1, 26 do + while true do + -- for i = 1, 26 do local seq = f:read() if seq == nil then break diff --git a/nerv/lib/matrix/cumatrix.c b/nerv/lib/matrix/cumatrix.c index aec4d60..43448bf 100644 --- a/nerv/lib/matrix/cumatrix.c +++ b/nerv/lib/matrix/cumatrix.c @@ -9,15 +9,19 @@ void nerv_cuda_context_print_profile(CuContext *context) { HashMap *profile = context->profile; size_t i; + float tmp, tot = 0; fprintf(stderr, "*** [nerv cumatrix profile] **\n"); for (i = 0; i < profile->size; i++) { HashNode *ptr; for (ptr = profile->bucket[i]; ptr; ptr = ptr->next) { - fprintf(stderr, "%s:\t%.6f\n", ptr->key, *(float *)ptr->val); + tmp = *(float *)ptr->val; + fprintf(stderr, "%s:\t%.6f\n", ptr->key, tmp); + tot += tmp; } } + fprintf(stderr, "Total time:\t%.6f\n", tot); } void nerv_cuda_context_clear_profile(CuContext *context) { diff --git a/nerv/lib/matrix/mmatrix.c b/nerv/lib/matrix/mmatrix.c index e40b160..006735d 100644 --- a/nerv/lib/matrix/mmatrix.c +++ b/nerv/lib/matrix/mmatrix.c @@ -8,15 +8,19 @@ void nerv_host_context_print_profile(MContext *context) { HashMap *profile = context->profile; size_t i; + float tmp, tot = 0; fprintf(stderr, "*** [nerv mmatrix profile] **\n"); for (i = 0; i < profile->size; i++) { HashNode *ptr; for (ptr = profile->bucket[i]; ptr; ptr = ptr->next) { - fprintf(stderr, "%s:\t%.6f\n", ptr->key, *(float *)ptr->val); + tmp = *(float *)ptr->val; + fprintf(stderr, "%s:\t%.6f\n", ptr->key, tmp); + tot += tmp; } } + fprintf(stderr, "Total time:\t%.6f\n", tot); } void nerv_host_context_clear_profile(MContext *context) { |