Changeset 5d57155 for GenericIOBenchmarkRead.cxx
- Timestamp:
- 09/25/17 16:15:39 (7 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GenericIOBenchmarkRead.cxx
r8f0a211 r5d57155 54 54 #define MASK_T uint16_t 55 55 56 struct pos_t { 57 POSVEL_T x, y, z, w; 58 }; 59 56 60 using namespace std; 57 61 using namespace gio; … … 64 68 MPI_Comm_size(MPI_COMM_WORLD, &commRanks); 65 69 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 66 78 if(argc != 2) { 67 fprintf(stderr,"USAGE: %s <mpiioName>\n", argv[0]);79 fprintf(stderr,"USAGE: %s [-a] <mpiioName>\n", argv[0]); 68 80 exit(-1); 69 81 } 70 82 71 char *mpiioName = argv[ 1];83 char *mpiioName = argv[a]; 72 84 73 85 vector<POSVEL_T> xx, yy, zz, vx, vy, vz, phi; 74 86 vector<ID_T> id; 75 87 vector<MASK_T> mask; 88 89 vector<pos_t> pos, vel; 76 90 77 91 assert(sizeof(ID_T) == 8); … … 93 107 Np = GIO.readNumElems(); 94 108 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 } 102 121 id.resize(Np + GIO.requestedExtraSpace()/sizeof(ID_T)); 103 122 mask.resize(Np + GIO.requestedExtraSpace()/sizeof(MASK_T)); 104 123 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); 114 138 115 139 GIO.readData(); 116 140 } // destroy GIO prior to calling MPI_Finalize 117 141 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 } 125 154 id.resize(Np); 126 155 mask.resize(Np);
Note: See TracChangeset
for help on using the changeset viewer.