@@ -81,15 +81,23 @@ void compute_loop(odla_computation comp) {
81
81
popart::StepIOCallback stepio (input_callback, input_complete_callback,
82
82
output_callback, output_complete_callback);
83
83
int i = 0 ;
84
+ bool info_printed = false ;
84
85
POPLAR_TRY
86
+ comp->set_thread_run (); // set the state to RUNNING
85
87
while (!comp->is_done ()) {
86
88
auto start = std::chrono::steady_clock::now ();
87
89
popart::logging::info (" This is the {} time for the inference" , i++);
88
90
if (i == INT_MAX) i = 0 ;
91
+ if (!info_printed) {
92
+ popart::logging::warn (
93
+ " Start to run the stepio with comp:{}, session:{}, device:{}" , comp,
94
+ comp->session .get (), comp->session ->getDevice ().getDeviceInfo ());
95
+ info_printed = true ;
96
+ }
89
97
comp->session ->run (stepio);
90
98
auto end = std::chrono::steady_clock::now ();
91
99
std::chrono::duration<double > elapsed_seconds = end - start;
92
- popart::logging::warn (
100
+ popart::logging::info (
93
101
" [ {} ] ONE_STEP takes {} s. Check whether more inference tasks "
94
102
" wating." ,
95
103
i, elapsed_seconds.count ());
@@ -99,11 +107,12 @@ void compute_loop(odla_computation comp) {
99
107
std::this_thread::sleep_for (std::chrono::milliseconds (1 ));
100
108
end = std::chrono::steady_clock::now ();
101
109
std::chrono::duration<double , std::milli> elapsed_ms = end - start;
102
- popart::logging::warn (" Found new tasks in {} ms." , elapsed_ms.count ());
110
+ popart::logging::info (" Found new tasks in {} ms." , elapsed_ms.count ());
103
111
}
104
112
POPLAR_CATCH
105
113
106
- popart::logging::info (" The pipeline loop finished" );
114
+ popart::logging::warn (
115
+ " The computation: {} pipeline loop finished after {} steps run" , comp, i);
107
116
comp->thread_done ();
108
117
}
109
118
@@ -184,6 +193,7 @@ odla_status _odla_computation::compile_and_export() {
184
193
185
194
odla_status _odla_computation::init (bool is_compile) {
186
195
if (!session) {
196
+ popart::logging::warn (" The computation:{} start to init" , this );
187
197
std::lock_guard<std::mutex> guard (init_mutex_);
188
198
if (!session) {
189
199
POPLAR_TRY
@@ -281,22 +291,26 @@ odla_status _odla_computation::init(bool is_compile) {
281
291
new_session->prepareDevice ();
282
292
new_session->setRandomSeed (0 ); // Init seed
283
293
new_session->weightsFromHost (); // Copy weights from host to IPU
284
- // If in parallel mode, start the thread
294
+ } else {
295
+ is_compile_only_ = true ;
296
+ }
297
+ // set session after all initialization done.
298
+ session = std::move (new_session);
299
+ // Thread must be started after all initialization done
300
+ if (!is_compile) {
285
301
ExecutionMode mode = PopartConfig::instance ()->execution_mode ();
286
302
if (PIPELINE == mode || PARALLEL == mode || PIPELINE_ASYNC == mode) {
287
303
std::thread parallel_thread (compute_loop, this );
288
- thread_state_ = RUNNING;
289
- popart::logging::warn ( " Parallel loop has been started" );
304
+ popart::logging::warn (
305
+ " The computation: {}, parallel loop has been started" , this );
290
306
parallel_thread.detach ();
291
307
}
292
- } else {
293
- is_compile_only_ = true ;
294
308
}
295
-
296
- session =
297
- std::move (new_session); // set session after all initialization done.
298
309
POPLAR_CATCH
299
310
}
311
+ popart::logging::warn (
312
+ " The computation:{} has been initialised with session:{}" , this ,
313
+ session.get ());
300
314
}
301
315
return ODLA_SUCCESS;
302
316
}
0 commit comments