提交 c5980c35 编写于 作者: D dongdaxiang

add _LINUX macro

test=develop
上级 433301fb
...@@ -12,8 +12,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,8 +12,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#if defined _WIN32 || defined __APPLE__
#else
#define _LINUX
#endif
#include "paddle/fluid/framework/data_feed.h" #include "paddle/fluid/framework/data_feed.h"
#ifdef _LINUX
#include <stdio_ext.h> #include <stdio_ext.h>
#endif
#include <utility> #include <utility>
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/io/zero_copy_stream_impl.h"
...@@ -101,6 +108,7 @@ bool PrivateQueueDataFeed<T>::Start() { ...@@ -101,6 +108,7 @@ bool PrivateQueueDataFeed<T>::Start() {
template <typename T> template <typename T>
void PrivateQueueDataFeed<T>::ReadThread() { void PrivateQueueDataFeed<T>::ReadThread() {
#ifdef _LINUX
std::string filename; std::string filename;
while (PickOneFile(&filename)) { while (PickOneFile(&filename)) {
int err_no = 0; int err_no = 0;
...@@ -112,6 +120,7 @@ void PrivateQueueDataFeed<T>::ReadThread() { ...@@ -112,6 +120,7 @@ void PrivateQueueDataFeed<T>::ReadThread() {
} }
} }
queue_->Close(); queue_->Close();
#endif
} }
template <typename T> template <typename T>
...@@ -248,6 +257,7 @@ void InMemoryDataFeed<T>::FillMemoryDataToChannel() { ...@@ -248,6 +257,7 @@ void InMemoryDataFeed<T>::FillMemoryDataToChannel() {
template <typename T> template <typename T>
void InMemoryDataFeed<T>::FillChannelToMemoryData() { void InMemoryDataFeed<T>::FillChannelToMemoryData() {
#ifdef _LINUX
VLOG(3) << "FillChannelToMemoryData, thread_id=" << thread_id_; VLOG(3) << "FillChannelToMemoryData, thread_id=" << thread_id_;
std::vector<T> local_vec; std::vector<T> local_vec;
std::shared_ptr<paddle::framework::BlockingQueue<T>> channel = nullptr; std::shared_ptr<paddle::framework::BlockingQueue<T>> channel = nullptr;
...@@ -278,10 +288,12 @@ void InMemoryDataFeed<T>::FillChannelToMemoryData() { ...@@ -278,10 +288,12 @@ void InMemoryDataFeed<T>::FillChannelToMemoryData() {
<< ", thread_id=" << thread_id_; << ", thread_id=" << thread_id_;
} }
std::vector<T>().swap(local_vec); std::vector<T>().swap(local_vec);
#endif
} }
template <typename T> template <typename T>
void InMemoryDataFeed<T>::LoadIntoMemory() { void InMemoryDataFeed<T>::LoadIntoMemory() {
#ifdef _LINUX
VLOG(3) << "LoadIntoMemory() begin, thread_id=" << thread_id_; VLOG(3) << "LoadIntoMemory() begin, thread_id=" << thread_id_;
std::vector<T> local_vec; std::vector<T> local_vec;
std::string filename; std::string filename;
...@@ -317,6 +329,7 @@ void InMemoryDataFeed<T>::LoadIntoMemory() { ...@@ -317,6 +329,7 @@ void InMemoryDataFeed<T>::LoadIntoMemory() {
} }
std::vector<T>().swap(local_vec); std::vector<T>().swap(local_vec);
VLOG(3) << "LoadIntoMemory() end, thread_id=" << thread_id_; VLOG(3) << "LoadIntoMemory() end, thread_id=" << thread_id_;
#endif
} }
template <typename T> template <typename T>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册