Using only omp_get_thread_num() in the parallel loop do not change the results. However, after commenting the pragmas, SQLiteManager is throwing an exception because stepping the statement in endTransaction() is returning SQLITE_IOERR_DELETE_NOENT <https://sqlite.org/rescode.html#ioerr_delete_noent> in the parallel loop. This behavior is reproduced in every multithreaded code that uses SQLiteManager (the automated tests for SQLiteManager that exercise database connections in multithreaded code are returning the same error).
2016-02-02 8:46 GMT-02:00 Clemens Ladisch <clemens at ladisch.de>: > Dominique Devienne wrote: > > On Tue, Feb 2, 2016 at 10:32 AM, Clemens Ladisch <clemens at ladisch.de> > wrote: > > > >> Vin?cius da Silva wrote: > >>> #pragma omp parallel for > >>> for( int i = 0; i < dispatchedThreads; ++i ) > >> > >> Does OMP guarantee that there is exactly one thread for each > >> loop iteration? > > > > Yes, OpenMP will execute each *iteration* in a single thread. > > The set of iterations will be spread on 1 or more thread, depending > > on OMP_NUM_THREADS. > > If i and omp_get_thread_num() are not the same, the code breaks. > > > Regards, > Clemens > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > -- Best Regards, Vin?cius da Silva <http://www.lcg.ufrj.br/Members/viniciusdasilva>, Ph. D. Student. PESC <http://www.cos.ufrj.br> - UFRJ <http://www.ufrj.br>