0
votes

I am trying to run a program written for MPI and OpenMP on a cluster of Linux dual cores.

When I try to set the OMP_NUM_THREADS variable

export OMP_NUM_THREADS=2

I get a message

OMP_NUM_THREADS: Undefined variable.

I don't get a better performance with OpenMP... I also tried:

mpiexec -n 10 -genv OMP_NUM_THREADS 2 ./binary

and omp_set_num_threads(2) inside the program, but it didn't get any better... Any ideas?

update: when I run mpiexec -n 1 ./binary with omp_set_num_threads(2) execution time is 4s and when I run mpiexec -f machines -n 1 ./binary execution time is 8s.

1
You should change some of your bold text to be code.Ding
much better thanks : )orestiss

1 Answers

0
votes

I would suggest doing an $echo OMP_NUM_THREADS first and further querying for the number of threads inside the program to make sure that threads are being spawned. Use the omp_get_num_threads() function for this. Further if you're using a MacOS then this blogpost can help: https://whiteinkdotorg.wordpress.com/2014/07/09/installing-mpich-using-macports-on-mac-os-x/ The latter part in this post will help you to successfully compile and run Hybrid programs. Whether a Hybrid program gets better performance or not depends a lot on contention of resources. Excessive usage of locks, barriers - can further slow the program down. It will be great if you post your code here for others to view and to actually help you.