Very high CPU% for openmp process

General OpenMP discussion

Very high CPU% for openmp process

Postby tllama » Wed Apr 10, 2013 11:51 am

I'm just starting out with OpenMP, trying to parallelize a for loop in Fortran.

It seems to work fine, it definitely creates the right number of threads and goes much faster than the original serial version.

However, the %CPU usage is huge, making me worry that the threads are being concentrated on just one or two cores (as opposed to examples I've seen online where each thread appears with its own PID).

Code: Select all
$ export omp_num_threads=12
$ nohup ./z90nr&
$ ps aurx
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
ty       25350 7771  0.0 1564928 26868 pts/9   Rl   14:18 169:40 ./z90nr


Is this a problem, and if so, how can I fix it?

I tried setting GOMP_CPU_AFFINITY, this did not solve the problem - also I'd rather not have to manually say which cores to use, since I am on a shared machine that is running all kinds of things. My understanding was that the default would be one thread per core, as long as there were enough cores (which there are).

Thank you!!
tllama
 
Posts: 1
Joined: Wed Apr 10, 2013 11:19 am

Re: Very high CPU% for openmp process

Postby MarkB » Thu Apr 11, 2013 3:43 am

Hi there,

If you are getting good speedups, then your threads are very unlikely to be sharing cores: I think the high %CPU usage is misleading, and not a problem. (Some versions of ps do aggregate the CPU usage across all threads in the PID, but you would not expect it to exceed 1200% with 12 threads). Do you see the same thing if you use top to monitor the CPU usage?

Hope that helps,
Mark.
MarkB
 
Posts: 434
Joined: Thu Jan 08, 2009 10:12 am


Return to Using OpenMP

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 13 guests