Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions cscs-checks/microbenchmarks/alloc_speed/alloc_speed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import reframe as rfm
import reframe.utility.sanity as sn


@rfm.parameterized_test(['no'], ['2M'])
class AllocSpeedTest(rfm.RegressionTest):
def __init__(self, hugepages):
super().__init__()

self.descr = 'Time to allocate 4096 MB using %s hugepages' % hugepages
self.sourcepath = 'alloc_speed.cpp'
self.build_system = 'SingleSource'
self.build_system.cxxflags = ['-O3', '-std=c++11']
self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc']
self.valid_prog_environs = ['PrgEnv-gnu']
if hugepages == 'no':
self.valid_systems += ['kesch:cn', 'kesch:pn']
else:
self.modules = ['craype-hugepages%s' % hugepages]

self.sanity_patterns = sn.assert_found('4096 MB', self.stdout)
self.perf_patterns = {
'time': sn.extractsingle(r'4096 MB, allocation time (?P<time>\S+)',
self.stdout, 'time', float)
}
self.sys_reference = {
'no': {
'dom:gpu': {
'time': (1.80, None, 0.10, 's')
},
'dom:mc': {
'time': (2.00, None, 0.10, 's')
},
'daint:gpu': {
'time': (1.80, None, 0.10, 's')
},
'daint:mc': {
'time': (2.00, None, 0.10, 's')
},
'kesch:cn': {
'time': (1.25, None, 0.10, 's')
},
'kesch:pn': {
'time': (0.55, None, 0.10, 's')
}
},
'2M': {
'dom:gpu': {
'time': (0.11, None, 0.10, 's')
},
'dom:mc': {
'time': (0.20, None, 0.10, 's')
},
'daint:gpu': {
'time': (0.11, None, 0.10, 's')
},
'daint:mc': {
'time': (0.20, None, 0.10, 's')
},
},
}
self.reference = self.sys_reference[hugepages]

self.maintainers = ['AK', 'VH']
self.tags = {'production'}
30 changes: 30 additions & 0 deletions cscs-checks/microbenchmarks/alloc_speed/src/alloc_speed.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <chrono>
#include <iostream>
#include <algorithm>
#include <memory>

double test_alloc(size_t n)
{
auto t_start = std::chrono::system_clock::now();
std::unique_ptr<char[]> ptr(new char[n]);

/* time to allocate + fill */
std::fill(ptr.get(), ptr.get() + n, 0);
auto t_alloc_fill = std::chrono::system_clock::now();

/* time too fill */
std::fill(ptr.get(), ptr.get() + n, 0);
auto t_alloc_two_fills = std::chrono::system_clock::now();

return std::chrono::duration_cast<std::chrono::duration<double>>((t_alloc_fill - t_start) - (t_alloc_two_fills - t_alloc_fill)).count();
}

int main(int argc, char** argv)
{
for (size_t i = 20; i < 33; ++i)
{
std::cout << (1L << i) / static_cast<double>(1024.0*1024.0) << " MB, allocation time " << test_alloc(1L << i) << " sec.\n";
}

return 0;
}