Ignore:
Timestamp:
08/26/16 19:28:54 (8 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master, pympi
Children:
981e22c
Parents:
72ac664
git-author:
Hal Finkel <hfinkel@…> (08/26/16 19:28:54)
git-committer:
Hal Finkel <hfinkel@…> (08/26/16 19:28:54)
Message:

The GIO write benchmark should not use completely trivial data (so compression is not trivial)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GenericIOBenchmarkWrite.cxx

    r72ac664 rcda87e9  
    4444#include <cstring> 
    4545#include <cmath> 
     46#include <algorithm> 
    4647#include <iostream> 
    4748#include <string> 
     
    5657using namespace std; 
    5758using namespace gio; 
     59 
     60template <typename T> 
     61struct Generator { 
     62    Generator(T start, T inc) : value(start), inc(inc) {} 
     63    T operator()() { 
     64      value += inc; 
     65      return value; 
     66    } 
     67 
     68    T value; 
     69    T inc; 
     70}; 
    5871 
    5972int main(int argc, char *argv[]) { 
     
    120133  mask.resize(Np + GIO.requestedExtraSpace()/sizeof(MASK_T)); 
    121134 
    122   std::fill(xx.begin(), xx.end(), 25); 
    123   std::fill(yy.begin(), yy.end(), 25); 
    124   std::fill(zz.begin(), zz.end(), 25); 
    125   std::fill(vx.begin(), vx.end(), 25); 
    126   std::fill(vy.begin(), vy.end(), 25); 
    127   std::fill(vz.begin(), vz.end(), 25); 
    128   std::fill(phi.begin(), phi.end(), 25); 
    129   std::fill(id.begin(), id.end(), 25); 
     135  std::generate(xx.begin(), xx.end(), Generator<POSVEL_T>(25, 3)); 
     136  std::generate(yy.begin(), yy.end(), Generator<POSVEL_T>(25, 3)); 
     137  std::generate(zz.begin(), zz.end(), Generator<POSVEL_T>(25, 3)); 
     138  std::generate(vx.begin(), vx.end(), Generator<POSVEL_T>(25, 3)); 
     139  std::generate(vy.begin(), vy.end(), Generator<POSVEL_T>(25, 3)); 
     140  std::generate(vz.begin(), vz.end(), Generator<POSVEL_T>(25, 3)); 
     141  std::generate(phi.begin(), phi.end(), Generator<POSVEL_T>(25, 3)); 
     142  std::generate(id.begin(), id.end(), Generator<ID_T>(25, 3)); 
    130143  std::fill(mask.begin(), mask.end(), 25); 
    131144 
Note: See TracChangeset for help on using the changeset viewer.