@@ -23,32 +23,28 @@ thread_work(
23
23
qvi_test_panic ("%s" , ers );
24
24
}
25
25
26
- char * binds = NULL ;
27
- int rc = qv_scope_bind_string (scope , QV_BIND_STRING_AS_LIST , & binds );
28
- if (rc != QV_SUCCESS ) {
29
- ers = "qv_bind_string() failed" ;
30
- qvi_test_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
31
- }
32
-
33
- fprintf (stdout ,"[%d] Thread running on %s\n" , tid , binds );
34
- free (binds );
35
-
36
26
int rank = 0 ;
37
- rc = qv_scope_group_rank (thargs -> scope , & rank );
27
+ int rc = qv_scope_group_rank (scope , & rank );
38
28
if (rc != QV_SUCCESS ) {
39
29
ers = "qv_scope_group_rank failed" ;
40
30
qvi_test_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
41
31
}
42
-
43
- fprintf (stdout ,"[%d] Thread %d splitting in two pieces\n" , tid , rank );
44
-
32
+
33
+ qvi_test_scope_report (scope , "thread_scope_in_thread_routine" );
34
+ qvi_test_emit_task_bind (scope );
35
+
36
+ fprintf (stdout ,"[%d] ============ Thread %d splitting in two pieces\n" , tid , rank );
45
37
qv_scope_t * pthread_subscope = NULL ;
46
- rc = qv_scope_split (thargs -> scope , 2 , rank , & pthread_subscope );
47
- if (rc != QV_SUCCESS ) {
38
+ rc = qv_scope_split (scope , 2 , rank , & pthread_subscope );
39
+ N if (rc != QV_SUCCESS ) {
48
40
ers = "qv_scope_split failed" ;
49
41
qvi_test_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
50
42
}
51
43
44
+ qvi_test_scope_report (pthread_subscope , "thread_subscope" );
45
+ qvi_test_emit_task_bind (pthread_subscope );
46
+
47
+
52
48
rc = qv_scope_free (pthread_subscope );
53
49
if (rc != QV_SUCCESS ) {
54
50
ers = "qv_scope_free failed" ;
@@ -101,21 +97,49 @@ main(void)
101
97
ers = "qv_scope_nobjs() failed" ;
102
98
qvi_test_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
103
99
}
100
+
101
+ qvi_test_scope_report (mpi_scope , "mpi_scope" );
102
+ qvi_test_emit_task_bind (mpi_scope );
103
+
104
+ //As Edgar pointed out, this will work only in the
105
+ //single process case.
106
+ //The mpi_scope need to be plsit in order to get
107
+ //a new mpi_single_process_scope
108
+
104
109
//
105
110
// Test qv_pthread_scope_split
106
111
//
107
112
int npieces = 2 ;
108
113
int nthreads = ncores ;
114
+ int stride = 1 ;
115
+ int colors [nthreads ];
116
+
117
+ printf ("[%d] Testing thread_scope_split (nthreads=%i, npieces=%i)\n" , tid , nthreads , npieces );
118
+
119
+ for (int i = 0 ; i < nthreads ; i ++ ) {
120
+ colors [i ] = i % npieces ;
121
+ }
109
122
110
- printf ("[%d] Testing thread_scope_split (nthreads=%i)\n" , tid , nthreads );
123
+ fprintf (stdout ,"Array values :" );
124
+ for (int i = 0 ; i < nthreads ; i ++ ) {
125
+ fprintf (stdout ,"val[%i]: %i |" ,i ,colors [i ]);
126
+ }
127
+ fprintf (stdout ,"\n" );
128
+
111
129
112
- int colors [nthreads ];
113
- rc = qv_pthread_colors_fill (colors , nthreads , QV_POLICY_PACKED , 1 , npieces );
130
+ rc = qv_pthread_colors_fill (colors , nthreads , QV_POLICY_PACKED , stride , ncores , npieces );
114
131
if (rc != QV_SUCCESS ) {
115
132
ers = "qv_pthread_colors_fill() failed" ;
116
133
qvi_test_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
117
134
}
118
135
136
+ fprintf (stdout ,"Array values :" );
137
+ for (int i = 0 ; i < nthreads ; i ++ ) {
138
+ fprintf (stdout ,"val[%i]: %i |" ,i ,colors [i ]);
139
+ }
140
+ fprintf (stdout ,"\n" );
141
+
142
+
119
143
qv_scope_t * * th_scopes = NULL ;
120
144
rc = qv_pthread_scope_split (
121
145
mpi_scope , npieces , colors , nthreads , & th_scopes
@@ -158,24 +182,37 @@ main(void)
158
182
ers = "qv_pthread_scope_free() failed" ;
159
183
qvi_test_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
160
184
}
185
+
161
186
#if 0
162
187
//Test qv_pthread_scope_split_at
163
188
nthreads = 2 * ncores ;
164
189
165
- fprintf ( stdout , "[%d] ====== Testing thread_scope_split_at (number of threads : %i)\n" , tid , nthreads );
190
+ printf ( "[%d] Testing thread_scope_split_at (nthreads= %i)\n" , tid , nthreads );
166
191
167
- int colors2 [nthreads ];
168
- /*
192
+ int colors2 [nthreads ];
169
193
for (int i = 0 ; i < nthreads ; i ++ ) {
170
194
colors2 [i ] = i % ncores ;
171
195
}
172
- */
173
- rc = qv_pthread_colors_fill (colors2 , nthreads , QV_POLICY_PACKED , 1 , ncores );
196
+
197
+ fprintf (stdout ,"Array values :" );
198
+ for (int i = 0 ; i < nthreads ; i ++ ) {
199
+ fprintf (stdout ,"val[%i]: %i |" ,i ,colors2 [i ]);
200
+ }
201
+ fprintf (stdout ,"\n" );
202
+
203
+
204
+ rc = qv_pthread_colors_fill (colors2 , nthreads , QV_POLICY_PACKED , stride , ncores , ncores );
174
205
if (rc != QV_SUCCESS ) {
175
206
ers = "qv_pthread_colors_fill() failed" ;
176
207
qvi_test_panic ("%s (rc=%s)" , ers , qv_strerr (rc ));
177
208
}
178
209
210
+ fprintf (stdout ,"Array values :" );
211
+ for (int i = 0 ; i < nthreads ; i ++ ) {
212
+ fprintf (stdout ,"val[%i]: %i |" ,i ,colors2 [i ]);
213
+ }
214
+ fprintf (stdout ,"\n" );
215
+
179
216
rc = qv_pthread_scope_split_at (
180
217
mpi_scope , QV_HW_OBJ_CORE , colors2 , nthreads , & th_scopes
181
218
);
0 commit comments