-1

I am a beginner of c++ parallel computing. However, my project requires that I would need to use c++98 (stdlibc++) for it. I search online and it seems most of the tutorials is based on c++11 thread. I noted that boost_thread is an implementation for c++98 but there seems to be much less available tutorial. So I would like to ask what is the best way for me to learn and implement parallel computing for my project.

Eventually, my project would require calculations based on hundreds of cores and computing nodes. Would multi-threading be sufficient or do I have to use Boost_MPI? Thank you.

1
  • 2
    std::thread (the C++11 implementation) is largely based on boost::thread, so most tutorials for std-based threading should be reasonably easy to adapt for boost-based threading. Aug 14, 2015 at 17:36

1 Answer 1

3

If you are limited to c++98 that means that you won't have all the thread managing and locking mechanisms as part of the language. Therefore you will have to implement them by yourself based on available OS APIs. There are different APIs for Windows and Linux. Here is an example of C++ wrapper for Linux pthread library. And this is an example of C++ wrapper for Windows Threads. So your project won't be portable unless you create (or find somewhere) a class which hides these libraries behind a common interface under which it implements the same logic for Windows and Linux differed by #ifdef WINDOWS / #ifdef LINUX.

Regarding

what is the best way for me to learn and implement parallel computing for my project.

There is no a correct answer for this. Look for some basic Multi Threading tutorials. Try to implement few simple programs (before you move to a big project) and come back when you face difficulties with more specific questions.

I have heard about boost but never used it so I can't provide any feedback on that. But again, you need to ask specific question. You can provide some specific requirements from your project and ask question based on them. Anyway dive into boost documentation, you can find there threads related libraries (also pay attention for boost usage license).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.