@@ -45,7 +45,8 @@ uniform_random_number()
45
45
void
46
46
print_usage ()
47
47
{
48
- printf ("Usage: srun -n ./vpicio sleep_time timestamps #particles\n" );
48
+ printf ("Usage: srun -n bdcats_batch sleep_time timestep #particles test_method(0:old API, 1:wait, "
49
+ "default 2:wait all)\n" );
49
50
}
50
51
51
52
int
@@ -81,7 +82,7 @@ main(int argc, char **argv)
81
82
* transfer_request_py , * transfer_request_pz , * transfer_request_id1 , * transfer_request_id2 , * ptr ,
82
83
* temp_requests ;
83
84
84
- uint64_t timestamps = 10 ;
85
+ uint64_t timestep = 10 ;
85
86
86
87
double start , end , transfer_start = .0 , transfer_wait = .0 , transfer_create = .0 , transfer_close = .0 ,
87
88
max_time , min_time , avg_time , total_time , start_total_time ;
@@ -99,7 +100,7 @@ main(int argc, char **argv)
99
100
sleep_time = (unsigned )atoi (argv [1 ]);
100
101
}
101
102
if (argc >= 3 ) {
102
- timestamps = atoll (argv [2 ]);
103
+ timestep = atoll (argv [2 ]);
103
104
}
104
105
if (argc >= 4 ) {
105
106
numparticles = atoll (argv [3 ]);
@@ -110,8 +111,8 @@ main(int argc, char **argv)
110
111
test_method = atoi (argv [4 ]);
111
112
}
112
113
if (!rank ) {
113
- printf ("sleep time = %u, timestamps = %" PRIu64 ", numparticles = %" PRIu64 ", test_method = %d\n" ,
114
- sleep_time , timestamps , numparticles , test_method );
114
+ printf ("sleep time = %u, timestep = %" PRIu64 ", numparticles = %" PRIu64 ", test_method = %d\n" ,
115
+ sleep_time , timestep , numparticles , test_method );
115
116
}
116
117
117
118
x = (float * )malloc (numparticles * sizeof (float ));
@@ -128,14 +129,14 @@ main(int argc, char **argv)
128
129
// create a pdc
129
130
pdc_id = PDCinit ("pdc" );
130
131
131
- obj_xx = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
132
- obj_yy = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
133
- obj_zz = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
134
- obj_pxx = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
135
- obj_pyy = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
136
- obj_pzz = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
137
- obj_id11 = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
138
- obj_id22 = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestamps );
132
+ obj_xx = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
133
+ obj_yy = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
134
+ obj_zz = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
135
+ obj_pxx = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
136
+ obj_pyy = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
137
+ obj_pzz = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
138
+ obj_id11 = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
139
+ obj_id22 = (pdcid_t * )malloc (sizeof (pdcid_t ) * timestep );
139
140
140
141
offset = (uint64_t * )malloc (sizeof (uint64_t ) * ndim );
141
142
offset_remote = (uint64_t * )malloc (sizeof (uint64_t ) * ndim );
@@ -153,69 +154,101 @@ main(int argc, char **argv)
153
154
region_id1 = PDCregion_create (ndim , offset , mysize );
154
155
region_id2 = PDCregion_create (ndim , offset , mysize );
155
156
156
- transfer_request_x = (pdcid_t * )malloc (sizeof (pdcid_t ) * (timestamps + 1 ) * N_OBJS );
157
- ptr = transfer_request_x + timestamps ;
157
+ transfer_request_x = (pdcid_t * )malloc (sizeof (pdcid_t ) * (timestep + 1 ) * N_OBJS );
158
+ ptr = transfer_request_x + timestep ;
158
159
transfer_request_y = ptr ;
159
- ptr += timestamps ;
160
+ ptr += timestep ;
160
161
transfer_request_z = ptr ;
161
- ptr += timestamps ;
162
+ ptr += timestep ;
162
163
transfer_request_px = ptr ;
163
- ptr += timestamps ;
164
+ ptr += timestep ;
164
165
transfer_request_py = ptr ;
165
- ptr += timestamps ;
166
+ ptr += timestep ;
166
167
transfer_request_pz = ptr ;
167
- ptr += timestamps ;
168
+ ptr += timestep ;
168
169
transfer_request_id1 = ptr ;
169
- ptr += timestamps ;
170
+ ptr += timestep ;
170
171
transfer_request_id2 = ptr ;
171
- ptr += timestamps ;
172
+ ptr += timestep ;
172
173
temp_requests = ptr ;
173
174
174
- for (i = 0 ; i < timestamps ; ++ i ) {
175
+ for (i = 0 ; i < timestep ; ++ i ) {
175
176
sprintf (obj_name , "obj-var-xx %" PRIu64 "" , i );
177
+ #ifdef ENABLE_MPI
176
178
obj_xx [i ] = PDCobj_open_col (obj_name , pdc_id );
179
+ #else
180
+ obj_xx [i ] = PDCobj_open (obj_name , pdc_id );
181
+ #endif
177
182
if (obj_xx [i ] == 0 ) {
178
183
printf ("Error getting an object id of %s from server, exit...\n" , "obj-var-xx" );
179
184
exit (-1 );
180
185
}
181
186
sprintf (obj_name , "obj-var-yy %" PRIu64 "" , i );
187
+ #ifdef ENABLE_MPI
182
188
obj_yy [i ] = PDCobj_open_col (obj_name , pdc_id );
189
+ #else
190
+ obj_yy [i ] = PDCobj_open (obj_name , pdc_id );
191
+ #endif
183
192
if (obj_yy [i ] == 0 ) {
184
193
printf ("Error getting an object id of %s from server, exit...\n" , "obj-var-yy" );
185
194
exit (-1 );
186
195
}
187
196
sprintf (obj_name , "obj-var-zz %" PRIu64 "" , i );
197
+ #ifdef ENABLE_MPI
188
198
obj_zz [i ] = PDCobj_open_col (obj_name , pdc_id );
199
+ #else
200
+ obj_zz [i ] = PDCobj_open (obj_name , pdc_id );
201
+ #endif
189
202
if (obj_zz [i ] == 0 ) {
190
203
printf ("Error getting an object id of %s from server, exit...\n" , "obj-var-zz" );
191
204
exit (-1 );
192
205
}
193
206
sprintf (obj_name , "obj-var-pxx %" PRIu64 "" , i );
207
+ #ifdef ENABLE_MPI
194
208
obj_pxx [i ] = PDCobj_open_col (obj_name , pdc_id );
209
+ #else
210
+ obj_pxx [i ] = PDCobj_open (obj_name , pdc_id );
211
+ #endif
195
212
if (obj_pxx [i ] == 0 ) {
196
213
printf ("Error getting an object id of %s from server, exit...\n" , "obj-var-pxx" );
197
214
exit (-1 );
198
215
}
199
216
sprintf (obj_name , "obj-var-pyy %" PRIu64 "" , i );
217
+ #ifdef ENABLE_MPI
200
218
obj_pyy [i ] = PDCobj_open_col (obj_name , pdc_id );
219
+ #else
220
+ obj_pyy [i ] = PDCobj_open (obj_name , pdc_id );
221
+ #endif
201
222
if (obj_pyy [i ] == 0 ) {
202
223
printf ("Error getting an object id of %s from server, exit...\n" , "obj-var-pyy" );
203
224
exit (-1 );
204
225
}
205
226
sprintf (obj_name , "obj-var-pzz %" PRIu64 "" , i );
227
+ #ifdef ENABLE_MPI
206
228
obj_pzz [i ] = PDCobj_open_col (obj_name , pdc_id );
229
+ #else
230
+ obj_pzz [i ] = PDCobj_open (obj_name , pdc_id );
231
+ #endif
207
232
if (obj_pzz [i ] == 0 ) {
208
233
printf ("Error getting an object id of %s from server, exit...\n" , "obj-var-pzz" );
209
234
exit (-1 );
210
235
}
211
236
sprintf (obj_name , "id11 %" PRIu64 "" , i );
237
+ #ifdef ENABLE_MPI
212
238
obj_id11 [i ] = PDCobj_open_col (obj_name , pdc_id );
239
+ #else
240
+ obj_id11 [i ] = PDCobj_open (obj_name , pdc_id );
241
+ #endif
213
242
if (obj_id11 [i ] == 0 ) {
214
243
printf ("Error getting an object id of %s from server, exit...\n" , "obj_id11" );
215
244
exit (-1 );
216
245
}
217
246
sprintf (obj_name , "id22 %" PRIu64 "" , i );
247
+ #ifdef ENABLE_MPI
218
248
obj_id22 [i ] = PDCobj_open_col (obj_name , pdc_id );
249
+ #else
250
+ obj_id22 [i ] = PDCobj_open (obj_name , pdc_id );
251
+ #endif
219
252
if (obj_id22 [i ] == 0 ) {
220
253
printf ("Error getting an object id of %s from server, exit...\n" , "obj_id22" );
221
254
exit (-1 );
@@ -227,7 +260,7 @@ main(int argc, char **argv)
227
260
start_total_time = MPI_Wtime ();
228
261
#endif
229
262
230
- for (i = 0 ; i < timestamps ; ++ i ) {
263
+ for (i = 0 ; i < timestep ; ++ i ) {
231
264
232
265
offset_remote [0 ] = rank * numparticles ;
233
266
region_xx = PDCregion_create (ndim , offset_remote , mysize );
@@ -244,49 +277,49 @@ main(int argc, char **argv)
244
277
#endif
245
278
if (test_method ) {
246
279
transfer_request_x [i ] =
247
- PDCregion_transfer_create (& x [0 ], PDC_WRITE , obj_xx [i ], region_x , region_xx );
280
+ PDCregion_transfer_create (& x [0 ], PDC_READ , obj_xx [i ], region_x , region_xx );
248
281
if (transfer_request_x [i ] == 0 ) {
249
282
printf ("Array x transfer request creation failed\n" );
250
283
return 1 ;
251
284
}
252
285
transfer_request_y [i ] =
253
- PDCregion_transfer_create (& y [0 ], PDC_WRITE , obj_yy [i ], region_y , region_yy );
286
+ PDCregion_transfer_create (& y [0 ], PDC_READ , obj_yy [i ], region_y , region_yy );
254
287
if (transfer_request_y [i ] == 0 ) {
255
288
printf ("Array y transfer request creation failed\n" );
256
289
return 1 ;
257
290
}
258
291
transfer_request_z [i ] =
259
- PDCregion_transfer_create (& z [0 ], PDC_WRITE , obj_zz [i ], region_z , region_zz );
292
+ PDCregion_transfer_create (& z [0 ], PDC_READ , obj_zz [i ], region_z , region_zz );
260
293
if (transfer_request_z [i ] == 0 ) {
261
294
printf ("Array z transfer request creation failed\n" );
262
295
return 1 ;
263
296
}
264
297
transfer_request_px [i ] =
265
- PDCregion_transfer_create (& px [0 ], PDC_WRITE , obj_pxx [i ], region_px , region_pxx );
298
+ PDCregion_transfer_create (& px [0 ], PDC_READ , obj_pxx [i ], region_px , region_pxx );
266
299
if (transfer_request_px [i ] == 0 ) {
267
300
printf ("Array px transfer request creation failed\n" );
268
301
return 1 ;
269
302
}
270
303
transfer_request_py [i ] =
271
- PDCregion_transfer_create (& py [0 ], PDC_WRITE , obj_pyy [i ], region_py , region_pyy );
304
+ PDCregion_transfer_create (& py [0 ], PDC_READ , obj_pyy [i ], region_py , region_pyy );
272
305
if (transfer_request_py [i ] == 0 ) {
273
306
printf ("Array py transfer request creation failed\n" );
274
307
return 1 ;
275
308
}
276
309
transfer_request_pz [i ] =
277
- PDCregion_transfer_create (& pz [0 ], PDC_WRITE , obj_pzz [i ], region_pz , region_pzz );
310
+ PDCregion_transfer_create (& pz [0 ], PDC_READ , obj_pzz [i ], region_pz , region_pzz );
278
311
if (transfer_request_pz [i ] == 0 ) {
279
312
printf ("Array pz transfer request creation failed\n" );
280
313
return 1 ;
281
314
}
282
315
transfer_request_id1 [i ] =
283
- PDCregion_transfer_create (& id1 [0 ], PDC_WRITE , obj_id11 [i ], region_id1 , region_id11 );
316
+ PDCregion_transfer_create (& id1 [0 ], PDC_READ , obj_id11 [i ], region_id1 , region_id11 );
284
317
if (transfer_request_id1 [i ] == 0 ) {
285
318
printf ("Array id1 transfer request creation failed\n" );
286
319
return 1 ;
287
320
}
288
321
transfer_request_id2 [i ] =
289
- PDCregion_transfer_create (& id2 [0 ], PDC_WRITE , obj_id22 [i ], region_id2 , region_id22 );
322
+ PDCregion_transfer_create (& id2 [0 ], PDC_READ , obj_id22 [i ], region_id2 , region_id22 );
290
323
if (transfer_request_id2 [i ] == 0 ) {
291
324
printf ("Array id2 transfer request creation failed\n" );
292
325
return 1 ;
@@ -549,7 +582,7 @@ main(int argc, char **argv)
549
582
MPI_Barrier (MPI_COMM_WORLD );
550
583
#endif
551
584
552
- for (i = 0 ; i < timestamps ; ++ i ) {
585
+ for (i = 0 ; i < timestep ; ++ i ) {
553
586
if (PDCobj_close (obj_xx [i ]) < 0 ) {
554
587
printf ("fail to close obj_xx\n" );
555
588
return 1 ;
0 commit comments