Is there a way that OpenMP can operate on Qt spanwed threads?

牧云@^-^@ 提交于 2020-01-04 04:00:44

问题


I'm trying to parallelize a number-crunching part of an application to make use of a quad-core architecture using OpenMP and GCC 4.2 on Mac OS 10.5. But what I think the problem is that this application uses Qt for the GUI and I'm trying to fork the worker threads on a secondary thread created by Qt which causes the program to crash - but of this I'm not sure.

I'm seriously on the dark here since it's my first time working with either Qt or OpenMP, (or C++ for that matter). Any sort of guidance is greatly appreciated.


回答1:


  1. Does the part using OpenMP work standalone, i.e. when not running in a Qt thread?
  2. Can you maybe tackle your problem using QtConcurrent or some other solution from the thread support in Qt?
  3. In any case, can you provide some of your code for illustration? Usually that makes matters a lot easier.



回答2:


At the moment this does not work. I think it even was reported as a bug in Qt and gcc - if I remember correctly. It was reported several times (e.g. here). It works with some gcc/Qt combinations at least on linux.



来源:https://stackoverflow.com/questions/3106455/is-there-a-way-that-openmp-can-operate-on-qt-spanwed-threads

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!