Skip to content

Commit 779c3ce

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into bugfix/bootstrap_python_version
2 parents 376f397 + 0237368 commit 779c3ce

File tree

8 files changed

+800
-90
lines changed

8 files changed

+800
-90
lines changed

cscs-checks/libraries/io/netcdf_compile_run.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,23 @@ def __init__(self, lang, linkage):
2222
self.lang = lang
2323
self.linkage = linkage
2424
self.descr = f'{lang_names[lang]} NetCDF {linkage.capitalize()}'
25-
self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc',
26-
'arolla:cn', 'tsa:cn']
25+
self.valid_systems = ['daint:gpu', 'daint:mc',
26+
'dom:gpu', 'dom:mc',
27+
'arolla:cn', 'tsa:cn',
28+
'eiger:mc']
29+
if linkage == 'static':
30+
self.valid_systems.remove('eiger:mc')
31+
2732
if self.current_system.name in ['daint', 'dom']:
2833
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu',
2934
'PrgEnv-intel', 'PrgEnv-pgi']
3035
self.modules = ['cray-netcdf']
3136
elif self.current_system.name in ['arolla', 'tsa']:
3237
self.exclusive_access = True
3338
self.valid_prog_environs = ['PrgEnv-gnu-nompi', 'PrgEnv-pgi-nompi']
39+
elif self.current_system.name in ['eiger']:
40+
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu']
41+
self.modules = ['cray-hdf5', 'cray-netcdf']
3442

3543
self.sourcesdir = os.path.join(self.current_system.resourcesdir,
3644
'netcdf')
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#ifndef BENCHES_HPP
2+
#define BENCHES_HPP
3+
4+
#include <limits>
5+
#include <cmath>
6+
#include <climits>
7+
8+
namespace nsimd {
9+
namespace benches {
10+
11+
template <typename T>
12+
double rand_sign() {
13+
if (std::is_unsigned<T>::value) {
14+
return 1.;
15+
} else {
16+
return (::rand() % 2) ? 1. : -1.;
17+
}
18+
}
19+
20+
template <typename T>
21+
T rand_bits(T min, T max = std::numeric_limits<T>::max()) {
22+
T r;
23+
do {
24+
int nbits = sizeof(T) * CHAR_BIT;
25+
uint64_t x = 0;
26+
for (int i = 0; i < nbits; ++i) {
27+
x |= uint64_t(::rand() % 2) << i;
28+
}
29+
r = *((T*)&x);
30+
} while (r < min || r > max);
31+
return r;
32+
}
33+
34+
template <typename T>
35+
T rand_from(T min, T max = std::numeric_limits<T>::max()) {
36+
// From: http://c-faq.com/lib/randrange.html
37+
return T(double(min)
38+
+ (double(::rand()) / (double(RAND_MAX) / (double(max) - double(min) + 1))));
39+
}
40+
41+
template <typename T>
42+
T rand_fp(T min, T max) {
43+
T r;
44+
if (std::isinf(min) && std::isinf(max)) {
45+
// For now, we're not using this method for random number
46+
//r = rand_bits<T>(min, max);
47+
r = rand_from<T>(-1000000, 1000000);
48+
} else {
49+
r = rand_from<T>(min, max);
50+
}
51+
return r;
52+
}
53+
54+
template <typename T>
55+
T rand(T min, T max = std::numeric_limits<T>::max()) {
56+
return rand_from<T>(min, max);
57+
}
58+
59+
template <>
60+
float rand<float>(float min, float max) {
61+
return rand_fp<float>(min, max);
62+
}
63+
64+
template <>
65+
double rand<double>(double min, double max) {
66+
return rand_fp<double>(min, max);
67+
}
68+
69+
}
70+
}
71+
72+
#endif

0 commit comments

Comments
 (0)