Skip to content

Commit a1e0f5a

Browse files
committed
add gzstream.cmake
1 parent 20f181c commit a1e0f5a

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ include(external/eigen) # download eigen3
176176
include(external/pybind11) # download pybind11
177177
include(external/cares)
178178
include(external/cub)
179+
include(external/gzstream)
179180

180181
if (NOT WIN32)
181182
# there is no official support of snappystream, warpctc, nccl, cupti in windows

cmake/external/gzstream.cmake

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
IF(MOBILE_INFERENCE)
17+
return()
18+
ENDIF()
19+
20+
include (ExternalProject)
21+
22+
# NOTE: gzstream is needed when linking with ctr reader.
23+
24+
SET(GZSTREAM_SOURCES_DIR ${THIRD_PARTY_PATH}/gzstream)
25+
SET(GZSTREAM_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gzstream)
26+
SET(GZSTREAM_INCLUDE_DIR "${GZSTREAM_INSTALL_DIR}/include/" CACHE PATH "gzstream include directory." FORCE)
27+
28+
ExternalProject_Add(
29+
extern_gzstream
30+
GIT_REPOSITORY "https://github.com/kanedo/gzstream.git"
31+
GIT_TAG ""
32+
PREFIX ${GZSTREAM_SOURCES_DIR}
33+
UPDATE_COMMAND ""
34+
CONFIGURE_COMMAND ""
35+
BUILD_IN_SOURCE 1
36+
BUILD_COMMAND make -j8
37+
INSTALL_COMMAND mkdir -p ${GZSTREAM_INSTALL_DIR}/lib/ && mkdir -p ${GZSTREAM_INSTALL_DIR}/include/
38+
&& cp ${GZSTREAM_SOURCES_DIR}/src/extern_gzstream/libgzstream.a ${GZSTREAM_INSTALL_DIR}/lib
39+
&& cp -r ${GZSTREAM_SOURCES_DIR}/src/extern_gzstream/gzstream.h ${GZSTREAM_INSTALL_DIR}/include
40+
)
41+
42+
ADD_LIBRARY(gzstream STATIC IMPORTED GLOBAL)
43+
SET_PROPERTY(TARGET gzstream PROPERTY IMPORTED_LOCATION
44+
"${GZSTREAM_INSTALL_DIR}/lib/libgzstream.a")
45+
46+
include_directories(${GZSTREAM_INCLUDE_DIR})
47+
ADD_DEPENDENCIES(gzstream extern_gzstream)

paddle/fluid/operators/reader/ctr_reader.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ class CTRReader : public framework::FileReader {
6161

6262
void Start() override {
6363
queue_->ReOpen();
64-
for (int i = 0; i < thread_num_; i++) {
65-
read_threads_.emplace_back(
66-
new std::thread(std::bind(&CTRReader::ReadThread, this, file_list_,
67-
slots_, batch_size_, queue_)));
68-
}
64+
// for (int i = 0; i < thread_num_; i++) {
65+
// read_threads_.emplace_back(
66+
// new std::thread(std::bind(&CTRReader::ReadThread, this,
67+
// file_list_,
68+
// slots_, batch_size_, queue_)));
69+
// }
6970
}
7071

7172
private:

0 commit comments

Comments
 (0)