GCC 4.2.0 released. Hello, OpenMP!

GCC 4.2.0 has been released (after some delays). The most interesting feature for me is that OpenMP is now supported for the C, C++ and Fortran compilers. OpenMP is already supported by the Intel and Microsoft Visual Studio 2005 compilers (but not the Express editions of the latter). OpenMP allows you to make use of all the spankin’ new cores on your brand new CPU, without requiring any thread programming on your part. See also Wikipedia: OpenMP and the OpenMP tutorial.

I’m still a little unsure about what happens when other threaded code calls into OpenMP threaded code (is it even safe to do this?). I’ll see if I can find out.

According to Ulrich Drepper in The Growing Importance of Parallel Programming, the OpenMP bits have already been backported to GCC 4.1 in Fedora Core 6 and RHEL 5. This is why I love the Fedora guys.

By the way, you can get recent versions of MATLAB (everything from R2006a and up) to make use of multiple cores through OpenMP by setting the OMP_NUM_THREADS environment variable to some number greater than 1 before running MATLAB. You’ll see multiple cores being used for operations like matrix-matrix multiplication.

Also look out for the new -fstrict-overflow option in GCC. I haven’t looked at this in detail yet, but it’s been mentioned on the numpy-discussion mailing list as something to take notice of.

Update: See also Linux.com: New GCC 4.2.0 — boon to developers, bore to distros and Google Video: GCC: Current Topics and Future Directions.

One Response to “GCC 4.2.0 released. Hello, OpenMP!”

  1. Ben Says:

    You can freely mix MPI and OpenMP code together. If you have multiple nodes with multiple cores/processors you can use MPI to branch out to the other nodes and use OpenMP to take advantage of the extra cores.

    Sure you can use MPI to address each core in each node but its faster if you mix MPI and OpenMP.

Leave a Reply