@@ -33,7 +33,6 @@ thread_work(
33
33
ctu_scope_report (scope , "thread_scope_in_thread_routine" );
34
34
ctu_emit_task_bind (scope );
35
35
#endif
36
-
37
36
if (rank == 0 ) {
38
37
printf ("[%d] ============ Splitting thread scopes in two\n" , tid );
39
38
}
@@ -81,38 +80,21 @@ main(void)
81
80
82
81
ctu_emit_task_bind (base_scope );
83
82
//
84
- // Test qv_pthread_scope_split
83
+ // Test qv_pthread_scope_split()
85
84
//
86
85
const int npieces = 2 ;
87
86
const int nthreads = ncores ;
88
- int colors [nthreads ];
89
87
90
88
printf (
91
89
"[%d] Testing thread_scope_split (nthreads=%d, npieces=%d)\n" ,
92
90
tid , nthreads , npieces
93
91
);
94
92
95
- for (int i = 0 ; i < nthreads ; i ++ ) {
96
- colors [i ] = i % npieces ;
97
- }
98
- #if 0
99
- printf ("Manual values: " );
100
- for (int i = 0 ; i < nthreads ; i ++ ) {
101
- printf ("val[%i]:%i | " ,i ,colors [i ]);
102
- }
103
- printf ("\n" );
104
- #endif
105
-
106
- #if 0
107
- fprintf (stdout ,"Filled values: " );
108
- for (int i = 0 ; i < nthreads ; i ++ ) {
109
- fprintf (stdout ,"val[%i]:%i | " ,i ,colors [i ]);
110
- }
111
- fprintf (stdout ,"\n" );
112
- #endif
113
93
qv_scope_t * * th_scopes = NULL ;
114
94
rc = qv_pthread_scope_split (
115
- base_scope , npieces , colors , nthreads , & th_scopes
95
+ base_scope , npieces ,
96
+ QV_PTHREAD_SCOPE_SPLIT_PACKED ,
97
+ nthreads , & th_scopes
116
98
);
117
99
if (rc != QV_SUCCESS ) {
118
100
ers = "qv_pthread_scope_split() failed" ;
@@ -152,39 +134,18 @@ main(void)
152
134
ers = "qv_pthread_scope_free() failed" ;
153
135
ctu_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
154
136
}
155
-
156
- #if 0
137
+ //
157
138
//Test qv_pthread_scope_split_at
158
- nthreads = 2 * ncores ;
159
-
160
- printf ("[%d] Testing thread_scope_split_at (nthreads=%i)\n" , tid , nthreads );
161
-
162
- int colors2 [nthreads ];
163
- for (int i = 0 ; i < nthreads ; i ++ ) {
164
- colors2 [i ] = i % ncores ;
165
- }
166
-
167
- fprintf (stdout ,"Array values :" );
168
- for (int i = 0 ; i < nthreads ; i ++ ) {
169
- fprintf (stdout ,"val[%i]: %i |" ,i ,colors2 [i ]);
170
- }
171
- fprintf (stdout ,"\n" );
172
-
173
-
174
- rc = qv_pthread_colors_fill (colors2 , nthreads , QV_POLICY_PACKED , stride , ncores );
175
- if (rc != QV_SUCCESS ) {
176
- ers = "qv_pthread_colors_fill() failed" ;
177
- ctu_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
178
- }
179
-
180
- fprintf (stdout ,"Array values :" );
181
- for (int i = 0 ; i < nthreads ; i ++ ) {
182
- fprintf (stdout ,"val[%i]: %i |" ,i ,colors2 [i ]);
183
- }
184
- fprintf (stdout ,"\n" );
139
+ //
140
+ printf (
141
+ "[%d] Testing thread_scope_split_at (nthreads=%d, npieces=%d)\n" ,
142
+ tid , nthreads , npieces
143
+ );
185
144
186
145
rc = qv_pthread_scope_split_at (
187
- mpi_scope , QV_HW_OBJ_CORE , colors2 , nthreads , & th_scopes
146
+ base_scope , QV_HW_OBJ_CORE ,
147
+ QV_PTHREAD_SCOPE_SPLIT_PACKED ,
148
+ nthreads , & th_scopes
188
149
);
189
150
if (rc != QV_SUCCESS ) {
190
151
ers = "qv_pthread_scope_split_at() failed" ;
@@ -215,14 +176,13 @@ main(void)
215
176
}
216
177
//fprintf(stdout,"Thread finished with '%s'\n", (char *)ret);
217
178
}
218
-
219
179
// Clean up.
220
180
rc = qv_pthread_scopes_free (nthreads , th_scopes );
221
181
if (rc != QV_SUCCESS ) {
222
182
ers = "qv_pthread_scope_free() failed" ;
223
183
ctu_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
224
184
}
225
- #endif
185
+
226
186
rc = qv_scope_free (base_scope );
227
187
if (rc != QV_SUCCESS ) {
228
188
ers = "qv_scope_free() failed" ;
0 commit comments