NCEPLIBS-ip 5.2.0
Loading...
Searching...
No Matches
ncpus.F
Go to the documentation of this file.
1C> @file
2C> Set number of cpus.
3C>
4C> ### Program History Log
5C> Date | Programmer | Comments
6C> -----|------------|---------
7C> 94-08-19 | Iredell | Initial.
8C> 98-11-09 | Vuong | Add doc>block and remove cray references.
9C> 1998-12-18 | Iredell | IBM SMP version.
10C> 2010-11-16 | Slovacek | Linux must have different call.
11C> 2012-11-01 | Mirvis | Multi-threading on LINUX-IBM/TIDE.
12C>
13C> @author Iredell @date 94-08-19
14
15C> Set number of CPUs - the number of processors over which
16C> to parallelize.
17C>
18C> @return Number of CPUs assigned.
19C>
20C> @author Iredell @date 94-08-19
21 FUNCTION ncpus()
22 INTEGER tid
23C Obtain thread number
24#ifdef openmp
25 INTEGER omp_get_num_threads,omp_get_thread_num
26!$OMP PARALLEL PRIVATE(TID)
27 tid = omp_get_thread_num()
28! PRINT *, '...............thread # ', TID
29 if (tid. eq. 0) then
30 ncpus=omp_get_num_threads()
31! PRINT *, 'totaly #------------------- of threads = ',NCPUS
32 endif
33!$OMP END PARALLEL
34#else
35 tid = 0
36 ncpus = 1
37#endif
38 RETURN
39 END
function ncpus()
Set number of CPUs - the number of processors over which to parallelize.
Definition ncpus.F:22