/[eiffelstudio]/branches/eth/eve/benchmarks/scoop/scoop_winnow/parfor_worker.e
ViewVC logotype

Contents of /branches/eth/eve/benchmarks/scoop/scoop_winnow/parfor_worker.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93415 - (show annotations)
Sun Nov 17 16:05:44 2013 UTC (5 years, 11 months ago) by wests
File size: 2637 byte(s)
Updating scoop benchmarks to improve speed, increase test case size.

1 class PARFOR_WORKER
2 create make
3 feature
4 make (start_, final_: INTEGER;
5 ncols_, nelts_: INTEGER;
6 matrix_array_, mask_array_: separate ARRAY2[INTEGER];
7 v_vector_, x_vector_, y_vector_: separate ARRAY [INTEGER])
8 do
9 start := start_
10 final := final_
11 ncols := ncols_
12 nelts := nelts_
13 matrix_array := matrix_array_
14 mask_array := mask_array_
15 v_vector := v_vector_
16 x_vector := x_vector_
17 y_vector := y_vector_
18 end
19
20 feature
21 live
22 do
23 get_result(fetch_array (matrix_array),
24 fetch_array (mask_array))
25 end
26
27
28 fetch_array (a_sep_array: separate ARRAY2[INTEGER]): ARRAY2 [INTEGER]
29 require
30 a_sep_array.generator /= Void
31 local
32 i, j: INTEGER
33 e: INTEGER
34 stopwatch: DT_STOPWATCH
35 do
36 create Result.make_filled (0, final - start + 1, ncols)
37 create stopwatch.make
38 stopwatch.start
39
40 from i := start
41 until i > final
42 loop
43 from j := 1
44 until j > ncols
45 loop
46 e := a_sep_array.item (i, j)
47 Result [to_local_row (i), j] := e
48 j := j + 1
49 end
50 i := i + 1
51 end
52
53 stopwatch.stop
54
55 print ("fetching array: " + stopwatch.elapsed_time.precise_time_out + "%N")
56 end
57
58
59 to_local_row (i: INTEGER): INTEGER
60 do
61 Result := i - start + 1
62 end
63
64 get_result(a_matrix, a_mask: ARRAY2[INTEGER])
65 local
66 i, j: INTEGER
67 count: INTEGER
68 val: VALUE3
69 stopwatch: DT_STOPWATCH
70 do
71 create stopwatch.make
72 stopwatch.start
73 create vector.make (10)
74
75 from
76 count := 1
77 i := start
78 until
79 i > final
80 loop
81 from j := 1
82 until j > ncols
83 loop
84 if a_mask [to_local_row (i), j] = 1 then
85 create val.make (a_matrix [to_local_row (i), j], i, j)
86 vector.extend (val)
87 count := count + 1
88 end
89 j := j + 1
90 end
91 i := i + 1
92 end
93 stopwatch.stop
94 print (stopwatch.elapsed_time.precise_time_out + "%N")
95 end
96
97 values_count: INTEGER
98 do
99 Result := vector.count
100 end
101
102 vec_item_x (i: INTEGER): INTEGER
103 do
104 Result := vector [i].x
105 end
106
107 vec_item_v (i: INTEGER): INTEGER
108 do
109 Result := vector [i].v
110 end
111
112 vec_item_y (i: INTEGER): INTEGER
113 do
114 Result := vector [i].y
115 end
116
117
118 feature {NONE}
119 vector: ARRAYED_LIST [VALUE3]
120
121 start, final: INTEGER
122 nelts: INTEGER
123 ncols: INTEGER
124 matrix_array, mask_array: separate ARRAY2[INTEGER];
125 v_vector, x_vector, y_vector: separate ARRAY [INTEGER]
126
127 end

Properties

Name Value
svn:eol-style native
svn:keywords author date id revision

  ViewVC Help
Powered by ViewVC 1.1.23