Getting Openmp to work with Clang

This is a quick note on how to get openmp to work with clang 3.7

They key is to include omp.h in the file,

go to openmp directory, cmake and then make, make sure you have the following two files

(1) omp.h

(2) libomp.so

Add omp.h to your include path and libomp.so to LD_LIBRARY_PATH

one other weird note is that instead of using -fopenmp flag, I had to use -fopenmp=libomp instead. Otherwise, I will be able to compile the openmp program, however, no matter what I do, I can only use a single thread. That is mp_get_num_threads() always return 1, even in parallel region, even when mp_get_num_procs() returns 48.

Advertisements
This entry was posted in Tools and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s