Ignore:
Timestamp:
09/25/17 16:15:39 (7 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master, pympi
Children:
b02d091
Parents:
fb69232
git-author:
Hal Finkel <hfinkel@…> (09/25/17 16:15:39)
git-committer:
Hal Finkel <hfinkel@…> (09/25/17 16:15:39)
Message:

Add support for float4 (and other homogeneous aggregates)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GenericIOBenchmarkRead.cxx

    r8f0a211 r5d57155  
    5454#define MASK_T uint16_t 
    5555 
     56struct pos_t { 
     57  POSVEL_T x, y, z, w; 
     58}; 
     59 
    5660using namespace std; 
    5761using namespace gio; 
     
    6468  MPI_Comm_size(MPI_COMM_WORLD, &commRanks); 
    6569 
     70  bool UseAOS = false; 
     71  int a = 1; 
     72  if (argc > 1 && string(argv[a]) == "-a") { 
     73    UseAOS = true; 
     74    --argc; 
     75    ++a; 
     76  } 
     77 
    6678  if(argc != 2) { 
    67     fprintf(stderr,"USAGE: %s <mpiioName>\n", argv[0]); 
     79    fprintf(stderr,"USAGE: %s [-a] <mpiioName>\n", argv[0]); 
    6880    exit(-1); 
    6981  } 
    7082 
    71   char *mpiioName = argv[1]; 
     83  char *mpiioName = argv[a]; 
    7284 
    7385  vector<POSVEL_T> xx, yy, zz, vx, vy, vz, phi; 
    7486  vector<ID_T> id; 
    7587  vector<MASK_T> mask; 
     88 
     89  vector<pos_t> pos, vel; 
    7690 
    7791  assert(sizeof(ID_T) == 8); 
     
    93107  Np = GIO.readNumElems(); 
    94108 
    95   xx.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
    96   yy.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
    97   zz.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
    98   vx.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
    99   vy.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
    100   vz.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
    101   phi.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     109  if (UseAOS) { 
     110    pos.resize(Np + (GIO.requestedExtraSpace() + sizeof(pos_t) - 1)/sizeof(pos_t)); 
     111    vel.resize(Np + (GIO.requestedExtraSpace() + sizeof(pos_t) - 1)/sizeof(pos_t)); 
     112  } else { 
     113    xx.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     114    yy.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     115    zz.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     116    vx.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     117    vy.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     118    vz.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     119    phi.resize(Np + GIO.requestedExtraSpace()/sizeof(POSVEL_T)); 
     120  } 
    102121  id.resize(Np + GIO.requestedExtraSpace()/sizeof(ID_T)); 
    103122  mask.resize(Np + GIO.requestedExtraSpace()/sizeof(MASK_T)); 
    104123 
    105   GIO.addVariable("x", xx, true); 
    106   GIO.addVariable("y", yy, true); 
    107   GIO.addVariable("z", zz, true); 
    108   GIO.addVariable("vx", vx, true); 
    109   GIO.addVariable("vy", vy, true); 
    110   GIO.addVariable("vz", vz, true); 
    111   GIO.addVariable("phi", phi, true); 
    112   GIO.addVariable("id", id, true); 
    113   GIO.addVariable("mask", mask, true); 
     124  if (UseAOS) { 
     125    GIO.addVariable("pos", pos, GenericIO::VarHasExtraSpace); 
     126    GIO.addVariable("vel", vel, GenericIO::VarHasExtraSpace); 
     127  } else { 
     128    GIO.addVariable("x", xx, GenericIO::VarHasExtraSpace); 
     129    GIO.addVariable("y", yy, GenericIO::VarHasExtraSpace); 
     130    GIO.addVariable("z", zz, GenericIO::VarHasExtraSpace); 
     131    GIO.addVariable("vx", vx, GenericIO::VarHasExtraSpace); 
     132    GIO.addVariable("vy", vy, GenericIO::VarHasExtraSpace); 
     133    GIO.addVariable("vz", vz, GenericIO::VarHasExtraSpace); 
     134    GIO.addVariable("phi", phi, GenericIO::VarHasExtraSpace); 
     135  } 
     136  GIO.addVariable("id", id, GenericIO::VarHasExtraSpace); 
     137  GIO.addVariable("mask", mask, GenericIO::VarHasExtraSpace); 
    114138 
    115139  GIO.readData(); 
    116140  } // destroy GIO prior to calling MPI_Finalize 
    117141 
    118   xx.resize(Np); 
    119   yy.resize(Np); 
    120   zz.resize(Np); 
    121   vx.resize(Np); 
    122   vy.resize(Np); 
    123   vz.resize(Np); 
    124   phi.resize(Np); 
     142  if (UseAOS) { 
     143    pos.resize(Np); 
     144    vel.resize(Np); 
     145  } else { 
     146    xx.resize(Np); 
     147    yy.resize(Np); 
     148    zz.resize(Np); 
     149    vx.resize(Np); 
     150    vy.resize(Np); 
     151    vz.resize(Np); 
     152    phi.resize(Np); 
     153  } 
    125154  id.resize(Np); 
    126155  mask.resize(Np); 
Note: See TracChangeset for help on using the changeset viewer.