问题
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:
- Does the part using OpenMP work standalone, i.e. when not running in a Qt thread?
- Can you maybe tackle your problem using QtConcurrent or some other solution from the thread support in Qt?
- 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