19 #ifndef SINGA_CORE_MEMORY_H_ 20 #define SINGA_CORE_MEMORY_H_ 24 #include "singa/proto/core.pb.h" 25 #include "singa/singa_config.h" 39 virtual void Malloc(
void** ptr,
const size_t size) = 0;
40 virtual void Free(
void* ptr) = 0;
44 return std::make_pair(0u, 0u);
58 CnMemPool(
int numDevices = 1,
size_t init_size = 256,
size_t max_size = 0);
59 CnMemPool(
const MemPoolConf& conf);
61 void Malloc(
void** ptr,
const size_t size);
64 std::pair<size_t, size_t> GetMemUsage()
override;
77 bool initialized_ =
false;
81 static std::atomic<int> pool_count;
86 void Malloc(
void** ptr,
const size_t size)
override;
87 void Free(
void* ptr)
override;
91 #endif // SINGA_CORE_MEMORY_H_ Manage device memory pool including garbage collection, memory opt.
Definition: memory.h:35
virtual std::pair< size_t, size_t > GetMemUsage()
Return a pair for free and total memory managed by this pool.
Definition: memory.h:43
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: common.h:48