# | Line 40 | Line 40 | |
---|---|---|
40 | */ | |
41 | #include <algorithm> | |
42 | #include "brains/BlockSnapshotManager.hpp" | |
43 | < | #include "utils/residentMem.h" |
44 | < | #include "utils/physmem.h" |
43 | > | //#include "utils/residentMem.h" |
44 | > | //#include "utils/physmem.h" |
45 | #include "utils/Algorithm.hpp" | |
46 | #include "brains/SimInfo.hpp" | |
47 | #include "io/DumpReader.hpp" | |
48 | ||
49 | namespace OpenMD { | |
50 | < | BlockSnapshotManager::BlockSnapshotManager(SimInfo* info, const std::string& filename, |
51 | < | int storageLayout, int blockCapacity) |
52 | < | : SnapshotManager(storageLayout), info_(info), blockCapacity_(blockCapacity), |
53 | < | activeBlocks_(blockCapacity_, -1), activeRefCount_(blockCapacity_, 0) { |
50 | > | BlockSnapshotManager::BlockSnapshotManager(SimInfo* info, |
51 | > | const std::string& filename, |
52 | > | int storageLayout, |
53 | > | long long int memSize, |
54 | > | int blockCapacity) |
55 | > | : SnapshotManager(storageLayout), info_(info), memSize_(memSize), |
56 | > | blockCapacity_(blockCapacity), activeBlocks_(blockCapacity_, -1), |
57 | > | activeRefCount_(blockCapacity_, 0) { |
58 | ||
59 | nAtoms_ = info->getNGlobalAtoms(); | |
60 | nRigidBodies_ = info->getNGlobalRigidBodies(); | |
61 | nCutoffGroups_ = info->getNCutoffGroups(); | |
62 | ||
63 | < | RealType physMem = physmem_total(); |
64 | < | RealType rssMem = residentMem(); |
65 | < | RealType avaliablePhysMem = physMem - rssMem; |
66 | < | |
63 | > | // eliminate suspect calls to figure out free memory: |
64 | > | // RealType physMem = physmem_total(); |
65 | > | // RealType rssMem = residentMem(); |
66 | > | // RealType avaliablePhysMem = physMem - rssMem; |
67 | ||
68 | int bytesPerStuntDouble = DataStorage::getBytesPerStuntDouble(storageLayout); | |
65 | – | |
69 | int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble; | |
70 | ||
71 | // total number of frames that can fit in memory | |
72 | < | RealType frameCapacity = avaliablePhysMem / bytesPerFrame; |
72 | > | //RealType frameCapacity = avaliablePhysMem / bytesPerFrame; |
73 | > | RealType frameCapacity = memSize_ / bytesPerFrame; |
74 | ||
75 | // number of frames in each block given the need to hold multiple blocks | |
76 | // in memory at the same time: | |
# | Line 89 | Line 93 | namespace OpenMD { | |
93 | std::cout << "-----------------------------------------------------"<<std::endl; | |
94 | std::cout << "BlockSnapshotManager memory report:" << std::endl; | |
95 | std::cout << "\n"; | |
96 | < | std::cout << " Physical Memory available:\t" << (unsigned long)physMem << " bytes" <<std::endl; |
97 | < | std::cout << " Resident Memory in use:\t" << (unsigned long)rssMem << " bytes" <<std::endl; |
98 | < | std::cout << "Memory available for OpenMD:\t" << (unsigned long)avaliablePhysMem << " bytes" <<std::endl; |
96 | > | // std::cout << " Physical Memory available:\t" << (unsigned long)physMem << " bytes" <<std::endl; |
97 | > | //std::cout << " Resident Memory in use:\t" << (unsigned long)rssMem << " bytes" <<std::endl; |
98 | > | //std::cout << "Memory available for OpenMD:\t" << (unsigned long)avaliablePhysMem << " bytes" <<std::endl; |
99 | > | std::cout << "Memory requested for OpenMD:\t" << (unsigned long)memSize_ << " bytes" <<std::endl; |
100 | std::cout << " Bytes per StuntDouble:\t" << (unsigned long)bytesPerStuntDouble <<std::endl; | |
101 | std::cout << " Bytes per Frame:\t" << (unsigned long)bytesPerFrame <<std::endl; | |
102 | std::cout << " Frame Capacity:\t" << (unsigned long)frameCapacity <<std::endl; |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |