55 |
|
nAtoms_ = info->getNGlobalAtoms(); |
56 |
|
nRigidBodies_ = info->getNGlobalRigidBodies(); |
57 |
|
|
58 |
< |
double physMem = physmem_total(); |
59 |
< |
double rssMem = residentMem(); |
60 |
< |
double avaliablePhysMem = physMem - rssMem; |
58 |
> |
RealType physMem = physmem_total(); |
59 |
> |
RealType rssMem = residentMem(); |
60 |
> |
RealType avaliablePhysMem = physMem - rssMem; |
61 |
> |
|
62 |
|
|
63 |
|
int bytesPerStuntDouble = DataStorage::getBytesPerStuntDouble(storageLayout); |
64 |
|
|
65 |
|
int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble; |
66 |
|
|
67 |
< |
int frameCapacity = int (avaliablePhysMem / bytesPerFrame); |
68 |
< |
|
69 |
< |
nSnapshotPerBlock_ = frameCapacity /blockCapacity_ ; |
67 |
> |
// total number of frames that can fit in memory |
68 |
> |
RealType frameCapacity = avaliablePhysMem / bytesPerFrame; |
69 |
> |
|
70 |
> |
// number of frames in each block given the need to hold multiple blocks |
71 |
> |
// in memory at the same time: |
72 |
> |
nSnapshotPerBlock_ = int(frameCapacity) / blockCapacity_; |
73 |
|
reader_ = new DumpReader(info, filename); |
74 |
|
nframes_ = reader_->getNFrames(); |
71 |
– |
|
75 |
|
int nblocks = nframes_ / nSnapshotPerBlock_; |
76 |
< |
if (nframes_ % nSnapshotPerBlock_ != 0) { |
76 |
> |
if (nframes_ % int(nSnapshotPerBlock_) != 0) { |
77 |
|
++nblocks; |
78 |
|
} |
79 |
|
|
85 |
|
|
86 |
|
snapshots_.insert(snapshots_.begin(), nframes_, static_cast<Snapshot*>(NULL)); |
87 |
|
|
88 |
< |
std::cout << "physmem = " << int(physMem) << "\trssMem = "<< int(rssMem) << "\t availablePhysMem = " << int(avaliablePhysMem) <<std::endl; |
89 |
< |
std::cout << "nSnapshotPerBlock = " << nSnapshotPerBlock_ << "\t total block = " << nblocks << std::endl; |
88 |
> |
std::cout << "-----------------------------------------------------"<<std::endl; |
89 |
> |
std::cout << "BlockSnapshotManager memory report:" << std::endl; |
90 |
> |
std::cout << "\n"; |
91 |
> |
std::cout << " Physical Memory available:\t" << (unsigned long)physMem << " bytes" <<std::endl; |
92 |
> |
std::cout << " Resident Memory in use:\t" << (unsigned long)rssMem << " bytes" <<std::endl; |
93 |
> |
std::cout << "Memory available for OOPSE:\t" << (unsigned long)avaliablePhysMem << " bytes" <<std::endl; |
94 |
> |
std::cout << " Bytes per StuntDouble:\t" << (unsigned long)bytesPerStuntDouble <<std::endl; |
95 |
> |
std::cout << " Bytes per Frame:\t" << (unsigned long)bytesPerFrame <<std::endl; |
96 |
> |
std::cout << " Frame Capacity:\t" << (unsigned long)frameCapacity <<std::endl; |
97 |
> |
std::cout << " Frames in trajectory:\t" << (unsigned long)nframes_ <<std::endl; |
98 |
> |
std::cout << " Snapshots per Block:\t" << (unsigned long)nSnapshotPerBlock_ <<std::endl; |
99 |
> |
std::cout << " Total number of Blocks:\t" << (unsigned long)nblocks << std::endl; |
100 |
> |
std::cout << "-----------------------------------------------------"<<std::endl; |
101 |
|
|
102 |
|
} |
103 |
|
|
116 |
|
} |
117 |
|
} |
118 |
|
|
119 |
+ |
|
120 |
+ |
// virtual Snapshot* BlockSnapshotManager::getSnapshot(int id) { |
121 |
+ |
// currentSnapshot_ = snapshots[id]; |
122 |
+ |
// return snapshots_[id]; |
123 |
+ |
//} |
124 |
+ |
|
125 |
|
int BlockSnapshotManager::getNActiveBlocks() { |
126 |
|
#ifdef __RWSTD |
127 |
|
int count = 0; |
226 |
|
Snapshot* oldSnapshot = currentSnapshot_; |
227 |
|
currentSnapshot_ = snapshot; |
228 |
|
reader_->readFrame(frame); |
229 |
< |
currentSnapshot_ = oldSnapshot; |
229 |
> |
|
230 |
> |
// What was this for? It doesn't make sense! |
231 |
> |
//currentSnapshot_ = oldSnapshot; |
232 |
> |
|
233 |
|
return snapshot; |
234 |
|
} |
235 |
|
|
237 |
|
return reader_->getNFrames(); |
238 |
|
} |
239 |
|
|
240 |
+ |
void BlockSnapshotManager::needCOMprops(bool ncp) { |
241 |
+ |
reader_->setNeedCOMprops(ncp); |
242 |
+ |
} |
243 |
+ |
|
244 |
|
} |