TRIQS/nrgljubljana_interface 4.0.0
A TRIQS application
Loading...
Searching...
No Matches
openmp.hpp
1#include <omp.h>
2
3#ifdef MKL
4#include <mkl_service.h>
5#include <mkl_types.h>
6#endif
7
8// Report OpenMP parallelization settings
9inline void report_openMP(std::ostream &s = std::cout) {
10 s << std::endl;
11 s << "[OpenMP] Max. number of threads: " << omp_get_max_threads() << std::endl;
12 s << "[OpenMP] Number of processors: " << omp_get_num_procs() << std::endl;
13 s << "[OpenMP] Dynamic thread adjustment: " << omp_get_dynamic() << std::endl;
14 s << "[OpenMP] Nested parallelism: " << omp_get_max_active_levels() << std::endl << std::endl;
15#ifdef MKL
16 MKLVersion version;
17 mkl_get_version(&version);
18 s << "Using Intel MKL library " << version.MajorVersion << "." << version.MinorVersion << "." << version.UpdateVersion << std::endl;
19 s << "Processor optimization: " << version.Processor << std::endl;
20 const int max_threads = mkl_get_max_threads();
21 // Portability hack
22# ifdef MKL_DOMAIN_BLAS
23# define NRG_MKL_DOMAIN_BLAS MKL_DOMAIN_BLAS
24# else
25# define NRG_MKL_DOMAIN_BLAS MKL_BLAS
26# endif
27 const int blas_max_threads = mkl_domain_get_max_threads(NRG_MKL_DOMAIN_BLAS);
28 const int dynamic = mkl_get_dynamic();
29 s << "max_threads=" << max_threads << " blas_max_threads=" << blas_max_threads << " dynamic=" << dynamic << std::endl << std::endl;
30#endif
31 s << std::endl;
32}