Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreComponents/LvArray
Submodule LvArray updated 2 files
+59 −0 src/system.cpp
+16 −4 src/system.hpp
5 changes: 2 additions & 3 deletions src/coreComponents/common/LifoStorageCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <mutex>
#include <condition_variable>
#include <camp/camp.hpp>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <algorithm>
Expand All @@ -38,7 +37,7 @@
#include "common/TimingMacros.hpp"
#include "common/FixedSizeDequeWithMutexes.hpp"
#include "common/MultiMutexesLock.hpp"

#include "LvArray/src/system.hpp"

namespace geos
{
Expand Down Expand Up @@ -155,7 +154,7 @@ class LifoStorageCommon
static int computeNumberOfBufferOnHost( int percent, size_t bufferSize, int maxNumberOfBuffers, int numberOfBuffersToStoreOnDevice )
{
GEOS_ERROR_IF( percent > 100, "Error, percentage of memory should be smallerer than -100, check lifoOnHost (should be greater that -100)" );
size_t free = sysconf( _SC_AVPHYS_PAGES ) * sysconf( _SC_PAGESIZE );
size_t free = LvArray::system::getAvailableMemoryOnHost();
int numberOfBuffersToStoreOnHost = std::max( 1, std::min( ( int )( 0.01 * percent * free / bufferSize ), maxNumberOfBuffers - numberOfBuffersToStoreOnDevice ) );
double freeGB = ( ( double ) free ) / ( 1024.0 * 1024.0 * 1024.0 ) / MpiWrapper::nodeCommSize();
LIFO_LOG_RANK( " LIFO : available memory on host " << freeGB << " GB" );
Expand Down
5 changes: 2 additions & 3 deletions src/coreComponents/common/LifoStorageCuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <camp/camp.hpp>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <algorithm>

#include "common/FixedSizeDeque.hpp"
Expand All @@ -30,6 +29,7 @@
#include "common/FixedSizeDequeWithMutexes.hpp"
#include "common/MultiMutexesLock.hpp"
#include "common/LifoStorageCommon.hpp"
#include "LvArray/src/system.hpp"

namespace geos
{
Expand Down Expand Up @@ -147,8 +147,7 @@ class LifoStorageCuda : public LifoStorageCommon< T, INDEX_TYPE >
static int computeNumberOfBufferOnDevice( int percent, size_t bufferSize, int maxNumberOfBuffers )
{
GEOS_ERROR_IF( percent > 100, "Error, percentage of memory should be smaller than 100, check lifoOnDevice (should be greater than -100)" );
size_t free, total;
GEOS_ERROR_IF( cudaSuccess != cudaMemGetInfo( &free, &total ), "Error getting CUDA device available memory" );
size_t free = LvArray::system::getAvailableMemoryOnDevice();
double freeGB = ( ( double ) free ) / ( 1024.0 * 1024.0 * 1024.0 );
LIFO_LOG_RANK( " LIFO : available memory on device " << freeGB << " GB" );
return std::min( ( int )( 0.01 * percent * free / bufferSize ), maxNumberOfBuffers );
Expand Down