2

Good day. I was attending a course on parallel and distributed programming and one of my assignment requires us to program in C language using parallel programming extensions such as Pthreads, MPI and OpenMP. The thing is, I have more exposure on C++ and I was wondering is C++ compatible with those parallel extensions as well?

If C++ is not compatible, is there any quick cheat sheets or advice on mastering C in a short period?

5
  • 1
    Pthreads works fine with C++. Pthreads is just a C API and for the most part C is a subset of C++. OpenMP needs support from the compiler (for instance Clang does not support it) and claims to work with C/C++. I have no idea about MPI. Do you mean OpenMPI Commented Sep 12, 2012 at 7:15
  • 4
    Several C++ compilers support OpenMP. pthreads are POSIX API simple to use from C++. MPI is language neutral interface, could use in Java as well. However, if your homework is C then you might want to stick to C. C++ and C are quite different languages. Commented Sep 12, 2012 at 7:17
  • 1
    @James, Open MPI is just one of the many implementations of the MPI standard. Commented Sep 12, 2012 at 9:21
  • For instance, in future we need to use C with parallel extension, which compiler is good in such situation? Commented Sep 12, 2012 at 14:15
  • @Law: All three libraries will work fine with C++ (I can confirm from experience). All major compilers (gcc, cl, icc) support openmp (at least to some degree). However, you won't be able to use pthreads except on linux (there are some implementations for windows, but I don't know how good they are). Commented Sep 13, 2012 at 10:35

1 Answer 1

1

All of them support C and C++, as say @Tudor. All popular compilers support OpenMP. To use MPI you need to install any realization of MPI, for example OpenMPI, mpich... pthreads is a POSIX standard for threads, but you can use it also under Windows (Pthreads-w32)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.