#include "HDF5Utils/Writer.h"
#include <random>
Go to the source code of this file.
|
| #define | ADD(NAME) |
| #define | HADD(NAME) |
◆ ADD
◆ HADD
Value:consumers.add(#NAME, [](
const out_t& o){
return o.NAME;}, 0,
h)
Header file for AthHistogramAlgorithm.
Definition at line 20 of file test-half-precision.cxx.
◆ consumer_t
◆ mt_t
| using mt_t = decltype(std::mt19937()) |
◆ fill()
| void fill |
( |
H5::Group & | out_file, |
|
|
size_t | iterations ) |
Definition at line 64 of file test-half-precision.cxx.
64 {
65
67 const int max_width = 10;
68 std::mt19937 random(42);
69
70
72 writer_t::configuration_type
config;
74 config.extent = {max_width};
79 std::uniform_int_distribution<int>
width(0, max_width+1);
80 for (
size_t n = 0;
n < iterations;
n++) {
83 half.fill(out);
84 }
85}
consumer_t getHalfConsumers()
std::vector< out_t > getOutputs(size_t length, mt_t &rand)
consumer_t getFullConsumers()
◆ getFullConsumers()
Definition at line 23 of file test-half-precision.cxx.
23 {
28 return consumers;
29}
H5Utils::Consumers< const out_t & > consumer_t
◆ getHalfConsumers()
◆ getOutputs()
| std::vector< out_t > getOutputs |
( |
size_t | length, |
|
|
mt_t & | rand ) |
Definition at line 44 of file test-half-precision.cxx.
44 {
45 std::vector<out_t> outvec;
46 std::uniform_int_distribution<int> exponent(-10, 2);
47 std::uniform_real_distribution<float> man(-0.0001, 0.0001);
48 std::uniform_int_distribution<short> booldist(0, 1);
49 for (
size_t n = 0;
n <
length;
n++) {
51 double value = std::exp2(exponent(rand)) * (1 + man(rand));
54 out.btype = booldist(rand);
55 outvec.push_back(out);
56 }
57 return outvec;
58}
◆ main()
| int main |
( |
int | nargs, |
|
|
char * | argv[] ) |
Definition at line 87 of file test-half-precision.cxx.
87 {
88 H5::H5File out_file("output.h5", H5F_ACC_TRUNC);
89 size_t iterations = 1;
90 if (nargs > 2) {
91 return 1;
92 }
93 if (nargs > 1) iterations = std::atoi(argv[1]);
94 fill(out_file, iterations);
95 return 0;
96}
void fill(H5::Group &out_file, size_t iterations)