シミュレータ アプリケーションの一部のシリアル コードに openMp コードを追加しました。このアプリケーションを使用するプログラムを実行すると、プログラムが「The thread 'Win32 Thread' (0x1828) has exited with code 1 (0x1)」という出力で予期せず終了します。これは、OpenMp コードを追加した並列領域で発生します。コード サンプルは次のとおりです。
#pragma omp parallel for private (curr_proc_info, current_writer, method_h) shared (exceptionOccured) schedule(dynamic, 1)
for (i = 0 ; i < method_process_num ; i++)
{
current_writer = 0;
// we need to add protection before we can dequeue a method from the methods queue,
#pragma omp critical(dequeueMethod)
method_h = pop_runnable_method(curr_proc_info, current_writer);
if(method_h !=0 && exceptionOccured == false){
try {
method_h->semantics();
}
catch( const sc_report& ex ) {
::std::cout << "\n" << ex.what() << ::std::endl;
m_error = true;
exceptionOccured = true; // we cannot jump outside the loop, so instead of return we use a flag and return somewhere else
}
}
}
スケジューリングは、動的にする前は静的でした。チャンク サイズ 1 で動的を追加した後、アプリケーションは終了する前に少し進みました。これは、並列領域内で何が起こっているかを示している可能性がありますか? ありがとう