forked from E3SM-Project/EKAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathekat_arch.cpp
More file actions
64 lines (57 loc) · 1.41 KB
/
Copy pathekat_arch.cpp
File metadata and controls
64 lines (57 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifdef _OPENMP
# include <omp.h>
#endif
#include <sstream>
#include "ekat/ekat_assert.hpp"
#include "ekat/util/ekat_arch.hpp"
#include "ekat/kokkos/ekat_kokkos_types.hpp"
/*
* Implementations of ekat_arch.hpp functions.
*/
namespace ekat {
std::string active_avx_string () {
std::string s;
#if defined __AVX512F__
s += "-AVX512F";
#endif
#if defined __AVX2__
s += "-AVX2";
#endif
#if defined __AVX__
s += "-AVX";
#endif
return s;
}
std::string ekat_config_string () {
std::stringstream ss;
ss << " ExecSpace name: " << DefaultDevice::execution_space::name() << "\n";
ss << " ExecSpace initialized: " << (DefaultDevice::execution_space::impl_is_initialized() ? "yes" : "no") << "\n";
ss << " active avx set: " << active_avx_string() << "\n"
// << " packsize " << EKAT_PACK_SIZE
<< " compiler id: " <<
#if defined __INTEL_COMPILER
"Intel\n"
#elif defined __INTEL_LLVM_COMPILER
"IntelLLVM\n"
#elif defined __HIPCC__
"AMD Clang\n"
#elif defined __GNUG__
"GCC\n"
#else
"unknown\n"
#endif
<< " default FPE mask: " <<
( get_default_fpes() == 0 ? "0 (NONE) \n" :
std::to_string(get_default_fpes()) + " (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW) \n")
<< " #host threads: " <<
#ifdef KOKKOS_ENABLE_OPENMP
Kokkos::OpenMP::concurrency()
#elif defined _OPENMP
omp_get_max_threads()
#else
1
#endif
<< "\n";
return ss.str();
}
} // namespace ekat