未验证 提交 f1c48f85 编写于 作者: T Thunderbrook 提交者: GitHub

release dataset (#37790)

上级 f4138cf9
......@@ -463,6 +463,11 @@ void DatasetImpl<T>::WaitPreLoadDone() {
// release memory data
template <typename T>
void DatasetImpl<T>::ReleaseMemory() {
release_thread_ = new std::thread(&DatasetImpl<T>::ReleaseMemoryFun, this);
}
template <typename T>
void DatasetImpl<T>::ReleaseMemoryFun() {
VLOG(3) << "DatasetImpl<T>::ReleaseMemory() begin";
if (input_channel_) {
input_channel_->Clear();
......
......@@ -63,6 +63,7 @@ class Dataset {
virtual void SetTrainerNum(int trainer_num) = 0;
// set fleet send batch size
virtual void SetFleetSendBatchSize(int64_t size) = 0;
virtual void ReleaseMemoryFun() = 0;
// set fs name and ugi
virtual void SetHdfsConfig(const std::string& fs_name,
const std::string& fs_ugi) = 0;
......@@ -168,8 +169,13 @@ template <typename T>
class DatasetImpl : public Dataset {
public:
DatasetImpl();
virtual ~DatasetImpl() {}
virtual ~DatasetImpl() {
if (release_thread_ != nullptr) {
release_thread_->join();
}
}
virtual void SetFileList(const std::vector<std::string>& filelist);
virtual void ReleaseMemoryFun();
virtual void SetThreadNum(int thread_num);
virtual void SetTrainerNum(int trainer_num);
virtual void SetFleetSendBatchSize(int64_t size);
......@@ -295,6 +301,7 @@ class DatasetImpl : public Dataset {
int64_t fleet_send_batch_size_;
int64_t fleet_send_sleep_seconds_;
std::vector<std::thread> preload_threads_;
std::thread* release_thread_ = nullptr;
bool merge_by_insid_;
bool parse_ins_id_;
bool parse_content_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册