| 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 |
|
|
| 62 |
< |
RealType physMem = physmem_total(); |
| 63 |
< |
RealType rssMem = residentMem(); |
| 64 |
< |
RealType avaliablePhysMem = physMem - rssMem; |
| 62 |
> |
// eliminate suspect calls to figure out free memory: |
| 63 |
> |
// RealType physMem = physmem_total(); |
| 64 |
> |
// RealType rssMem = residentMem(); |
| 65 |
> |
// RealType avaliablePhysMem = physMem - rssMem; |
| 66 |
|
|
| 62 |
– |
|
| 67 |
|
int bytesPerStuntDouble = DataStorage::getBytesPerStuntDouble(storageLayout); |
| 68 |
|
|
| 69 |
|
int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble; |
| 70 |
|
|
| 71 |
|
// total number of frames that can fit in memory |
| 72 |
< |
RealType frameCapacity = avaliablePhysMem / bytesPerFrame; |
| 72 |
> |
|
| 73 |
> |
//RealType frameCapacity = avaliablePhysMem / bytesPerFrame; |
| 74 |
> |
RealType frameCapacity = memSize_ / bytesPerFrame; |
| 75 |
|
|
| 76 |
|
// number of frames in each block given the need to hold multiple blocks |
| 77 |
|
// in memory at the same time: |
| 94 |
|
std::cout << "-----------------------------------------------------"<<std::endl; |
| 95 |
|
std::cout << "BlockSnapshotManager memory report:" << std::endl; |
| 96 |
|
std::cout << "\n"; |
| 97 |
< |
std::cout << " Physical Memory available:\t" << (unsigned long)physMem << " bytes" <<std::endl; |
| 98 |
< |
std::cout << " Resident Memory in use:\t" << (unsigned long)rssMem << " bytes" <<std::endl; |
| 99 |
< |
std::cout << "Memory available for OpenMD:\t" << (unsigned long)avaliablePhysMem << " bytes" <<std::endl; |
| 97 |
> |
// std::cout << " Physical Memory available:\t" << (unsigned long)physMem << " bytes" <<std::endl; |
| 98 |
> |
//std::cout << " Resident Memory in use:\t" << (unsigned long)rssMem << " bytes" <<std::endl; |
| 99 |
> |
//std::cout << "Memory available for OpenMD:\t" << (unsigned long)avaliablePhysMem << " bytes" <<std::endl; |
| 100 |
> |
std::cout << "Memory requested for OpenMD:\t" << (unsigned long)memSize_ << " bytes" <<std::endl; |
| 101 |
|
std::cout << " Bytes per StuntDouble:\t" << (unsigned long)bytesPerStuntDouble <<std::endl; |
| 102 |
|
std::cout << " Bytes per Frame:\t" << (unsigned long)bytesPerFrame <<std::endl; |
| 103 |
|
std::cout << " Frame Capacity:\t" << (unsigned long)frameCapacity <<std::endl; |