annotate TaskManager/Gpu/GpuScheduler.h @ 1513:18b63e697c61 draft

many_task/quick_sort is changed recursive to loop
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Mon, 08 Oct 2012 02:03:18 +0900
parents 0e1318e7caed
children b3644b73d2cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1434
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #ifndef INCLUDED_GPU_SCHEDULER
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #define INCLUDED_GPU_SCHEDULER
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include "Scheduler.h"
1447
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
5 #include "FifoDmaManager.h"
1480
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
6 #include "GpuThreads.h"
1506
a7895ab4d0e3 add flip flag and NDRange flag
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1486
diff changeset
7 #include "HTask.h"
1434
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 #ifdef __APPLE__
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 #include <OpenCL/opencl.h>
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 #else
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 #include <CL/cl.h>
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 #endif
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 class GpuScheduler : public Scheduler {
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 public:
1471
e8db2e2d426c fix not working yet.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1447
diff changeset
17 GpuScheduler();
1506
a7895ab4d0e3 add flip flag and NDRange flag
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1486
diff changeset
18 virtual ~GpuScheduler();
1434
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 void init_impl(int useRefDma);
1480
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
20 void init_gpu();
1447
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
21 void run();
1508
0e1318e7caed create sort test
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1506
diff changeset
22
1447
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
23 void mail_write_from_host(memaddr data) {
1482
85a848d7f181 fix CpuThreads
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
24 fifoDmaManager->mail_write_from_host(data);
1447
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
25 }
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
26
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
27 memaddr mail_read_from_host() {
1508
0e1318e7caed create sort test
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1506
diff changeset
28 return fifoDmaManager->mail_read_from_host();
1447
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
29 }
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
30
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
31 int has_mail_from_host() {
1508
0e1318e7caed create sort test
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1506
diff changeset
32 return fifoDmaManager->has_mail_from_host();
1447
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
33 }
1434
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
1480
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
35 cl_platform_id platform_id;
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
36 cl_device_id device_id;
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
37 cl_uint ret_num_platforms;
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
38 cl_uint ret_num_devices;
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
39 cl_context context;
1508
0e1318e7caed create sort test
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1506
diff changeset
40 cl_command_queue *command_queue;
1480
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
41 cl_int ret;
1434
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 private:
1447
e8ff87511f46 debug GpuThreads
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1438
diff changeset
43 FifoDmaManager *fifoDmaManager;
1486
756aa0f08814 gpu task loader
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1485
diff changeset
44 void load_kernel(int cmd);
1480
f2512fb94223 GpuTaskManager no compile error
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1478
diff changeset
45
1434
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 };
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
1513
18b63e697c61 many_task/quick_sort is changed recursive to loop
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1508
diff changeset
48 #define GpuSchedRegister(str, filename, functionname) \
18b63e697c61 many_task/quick_sort is changed recursive to loop
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1508
diff changeset
49 gpu_register_task(str, filename, functionname);
18b63e697c61 many_task/quick_sort is changed recursive to loop
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1508
diff changeset
50
18b63e697c61 many_task/quick_sort is changed recursive to loop
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1508
diff changeset
51 #define GpuNDRangeRegister(str, dimension, g_worksizePtr) \
18b63e697c61 many_task/quick_sort is changed recursive to loop
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1508
diff changeset
52 gpu_register_ndrange(str, dimension, g_worksizePtr);
1485
cdf5d5d60b71 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1483
diff changeset
53
1434
05d480ab70ba add GpuScheduler
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 #endif
1435
9f6ba00ca15c add gpu_sched_register
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1434
diff changeset
55
1513
18b63e697c61 many_task/quick_sort is changed recursive to loop
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1508
diff changeset
56 extern void gpu_register_task(int cmd,const char* filename,const char* functionname);
18b63e697c61 many_task/quick_sort is changed recursive to loop
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1508
diff changeset
57 extern void gpu_register_ndrange(int, int, size_t*);