[Wrf-users] How to limit number of threads in 'smpar' OpenMP runs?
Dmitry N. Mikushin
maemarcus at gmail.com
Sat Sep 10 02:54:27 MDT 2011
Hi Anders,
> I tried setting the environment variable
> 'OMP_NUM_THREADS=4' prior to configuration and compilation.
I think OMP_NUM_THREADS is a runtime setting, i.e. it affects only the
resulting OpenMP application. So you should specify OMP_NUM_THREADS=4
with wrf.exe invocation. Then OMP_GET_MAX_THREADS should be adjusted
to this number. My guess is based on the following test case:
[marcusmae at loveland omptest]$ cat omptest.c
#include <omp.h>
#include <stdio.h>
int main()
{
printf("omp_get_max_threads = %d\n", omp_get_max_threads());
return 0;
}
[marcusmae at loveland omptest]$ make
gcc -fopenmp omptest.c -o omptest
[marcusmae at loveland omptest]$ ./omptest
omp_get_max_threads = 2
[marcusmae at loveland omptest]$ OMP_NUM_THREADS=4 ./omptest
omp_get_max_threads = 4
[marcusmae at loveland omptest]$
- D.
2011/9/8 Anders A Nottrott <anottrot at ucsd.edu>:
> Hi All,
>
>
>
> I am trying to run an ideal LES simulation as a parallel process (i.e. using
> option 'smpar'). I have an 8 core machine but I would like to limit the
> number of threads to 4. I tried setting the environment variable
> 'OMP_NUM_THREADS=4' prior to configuration and compilation. However, when I
> run wrf.exe I get the following just before the simulation begins:
>
> WRF NUMBER OF TILES FROM OMP_GET_MAX_THREADS = 8
> WRF TILE 1 IS 1 IE 100 JS 1 JE 13
> WRF TILE 2 IS 1 IE 100 JS 14 JE 26
> WRF TILE 3 IS 1 IE 100 JS 27 JE 38
> WRF TILE 4 IS 1 IE 100 JS 39 JE 50
> WRF TILE 5 IS 1 IE 100 JS 51 JE 62
> WRF TILE 6 IS 1 IE 100 JS 63 JE 74
> WRF TILE 7 IS 1 IE 100 JS 75 JE 87
> WRF TILE 8 IS 1 IE 100 JS 88 JE 100
> WRF NUMBER OF TILES = 8
>
> I looked in 'module_tiles.F' and it appears that the variable 'num_tiles' is
> assigned by the OMP_GET_MAX_THREADS function. Perhaps this is overriding the
> environment setting??? Note that when I check my system performance the code
> is running on all 8 cores, but this is not efficient since I want to run
> other process on my machine.
>
>
>
> I also messed with some of the parameters in the namelist, e.g. ‘tile_sz_x’,
> ‘tile_sz_y’, ‘numtiles’, ‘nproc_x’, ‘nproc_y’, but to no avail.
>
>
>
> Any suggestions will be most appreciated.
>
>
>
> Regards,
>
>
>
> Anders
>
>
>
>
>
> Anders Nottrott
>
> PhD Student, Mechanical and Environmental Engineering
>
> University of California, San Diego
>
> Department of Mechanical and Aerospace Engineering
>
> Website: <solar.ucsd.edu/nottrott>
>
>
>
> _______________________________________________
> Wrf-users mailing list
> Wrf-users at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/wrf-users
>
>
More information about the Wrf-users
mailing list