3 ms·
This may be pedantic, but the #pragma seems more to be overriding the serial semantics, rather than complementing it. BTW: what do you think of OpenMP? What ar
by numeromancer 15y ago
This may be pedantic, but the #pragma seems more to be overriding the serial semantics, rather than complementing it.
BTW: what do you think of OpenMP? What are its conveniences and frustrations? I may be looking into ways of doing embedded parallel development soon, and OpenMP looks convenient, since it's implemented in gcc.
- scott_s 15y agoNo, semantics are what something means. The results of executing the code - it's semantics - are the same with and without the pragma. If that distinction bothers you, consider that compilers perform all sort of dirty tricks when optimizations are turned on, sorts of things that you didn't ask it to do, but it is allowed to do because it preserves semantics. If you have data parallel code and you're working in C, C++ or Fortran, OpenMP is an excellent solution to gain performance from shared memory parallel machines. While I say above that it's a hack, it's a hack in terms of language design, it works. It's a very well defined standard, and any problem that you have will have been encountered by thousands of people before you, so you should be able to find solutions online easily. It's super convenient for data parallel code like the above. It's frustrating when you want to do task parallelism. I'm unfamiliar with OpenMP in the embedded world, though. OpenMP in gcc relies on Pthreads, and I don't know if that will be supported on your platform.