changeset 1641:289378e5abf8 draft

add print flag
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 18 Jun 2013 18:52:42 +0900
parents 30c1f43493db
children b975f29893c7
files TaskManager/Gpu/GpuThreads.cc TaskManager/Gpu/GpuThreads.h example/multiply/main.cc
diffstat 3 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuThreads.cc	Tue Jun 18 18:45:25 2013 +0900
+++ b/TaskManager/Gpu/GpuThreads.cc	Tue Jun 18 18:52:42 2013 +0900
@@ -56,9 +56,10 @@
     return NULL;
 }
 
-void
+int
 GpuThreads::spawn_task(int id, TaskListPtr p) {
     send_mail(id, 1, (memaddr*)p);
+    return 0;
 }
 
 int
--- a/TaskManager/Gpu/GpuThreads.h	Tue Jun 18 18:45:25 2013 +0900
+++ b/TaskManager/Gpu/GpuThreads.h	Tue Jun 18 18:52:42 2013 +0900
@@ -35,7 +35,7 @@
     
     void init();
     static void *gpu_thread_run(void *args);
-    virtual void spawn_task(int cpu_num, TaskListPtr p);
+    virtual int spawn_task(int cpu_num, TaskListPtr p);
     int get_mail(int speid, int count, memaddr *ret);
     int has_mail(int speid, int count, memaddr *ret);
     void send_mail(int speid, int num, memaddr *data);
--- a/example/multiply/main.cc	Tue Jun 18 18:45:25 2013 +0900
+++ b/example/multiply/main.cc	Tue Jun 18 18:52:42 2013 +0900
@@ -40,11 +40,11 @@
 static void
 print_result() {
     printf("---\n");
-
-    for (int i =0;i<length;i++) {
-        printf("%f * %f = %f \n",A[i],B[i],C[i]);
+    if(print_flag == 1) {
+        for (int i =0;i<length;i++) {
+            printf("%f * %f = %f \n",A[i],B[i],C[i]);
+        }
     }
-        
     printf("---\n");
 }
 
@@ -56,7 +56,7 @@
             length = atoi(argv[++i]);
         } else if (strcmp(argv[i], "-t") == 0) {
             task = atoi(argv[++i]);
-        } else if (strcmp(argv[i], "-p") == 0) {
+        } else if (strcmp(argv[i], "-print") == 0) {
             print_flag = 1;
         }
     }