Skip to content

Commit fea5a16

Browse files
committed
add define
1 parent c112357 commit fea5a16

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

cmake/third_party.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,10 @@ if (WITH_PSCORE)
305305
include(external/libmct) # download, build, install libmct
306306
list(APPEND third_party_deps extern_libmct)
307307

308-
include(external/rocksdb) # download, build, install libmct
309-
list(APPEND third_party_deps extern_rocksdb)
308+
if (WITH_HETERPS)
309+
include(external/rocksdb) # download, build, install libmct
310+
list(APPEND third_party_deps extern_rocksdb)
311+
endif()
310312
endif()
311313

312314
if(WITH_XBYAK)

paddle/fluid/distributed/table/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ set_source_files_properties(common_graph_table.cc PROPERTIES COMPILE_FLAGS ${DIS
1616

1717
get_property(RPC_DEPS GLOBAL PROPERTY RPC_DEPS)
1818

19-
cc_library(common_table SRCS common_sparse_table.cc ssd_sparse_table.cc common_dense_table.cc
20-
sparse_geo_table.cc barrier_table.cc common_graph_table.cc DEPS ${TABLE_DEPS}
19+
set(EXTERN_DEP "")
20+
if(WITH_HETERPS)
21+
set(TABLE_SRC common_sparse_table.cc ssd_sparse_table.cc common_dense_table.cc sparse_geo_table.cc barrier_table.cc common_graph_table.cc)
22+
set(EXTERN_DEP rocksdb)
23+
else()
24+
set(TABLE_SRC common_sparse_table.cc common_dense_table.cc sparse_geo_table.cc barrier_table.cc common_graph_table.cc)
25+
endif()
26+
27+
cc_library(common_table SRCS ${TABLE_SRC} DEPS ${TABLE_DEPS}
2128
${RPC_DEPS} graph_edge graph_node device_context string_helper
22-
simple_threadpool xxhash generator rocksdb)
29+
simple_threadpool xxhash generator ${EXTERN_DEP})
2330

2431
set_source_files_properties(tensor_accessor.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
2532
set_source_files_properties(tensor_table.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
@@ -29,4 +36,3 @@ cc_library(tensor_table SRCS tensor_table.cc DEPS eigen3 ps_framework_proto exec
2936
set_source_files_properties(table.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
3037

3138
cc_library(table SRCS table.cc DEPS common_table tensor_accessor tensor_table ps_framework_proto string_helper device_context gflags glog boost)
32-
#target_link_libraries(table -lbz2)

paddle/fluid/distributed/table/depends/rocksdb_warpper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#ifdef PADDLE_WITH_HETERPS
1516
#include <glog/logging.h>
1617
#include <rocksdb/db.h>
1718
#include <rocksdb/filter_policy.h>
@@ -154,3 +155,4 @@ class RocksDBHandler {
154155
};
155156
}
156157
}
158+
#endif

paddle/fluid/distributed/table/ssd_sparse_table.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#ifdef PADDLE_WITH_HETERPS
1516
#include "paddle/fluid/distributed/table/ssd_sparse_table.h"
1617

1718
DEFINE_string(rocksdb_path, "database", "path of sparse table rocksdb file");
@@ -358,3 +359,4 @@ int64_t SSDSparseTable::LoadFromText(
358359

359360
} // namespace ps
360361
} // namespace paddle
362+
#endif

paddle/fluid/distributed/table/ssd_sparse_table.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#pragma once
1616
#include "paddle/fluid/distributed/table/common_sparse_table.h"
1717
#include "paddle/fluid/distributed/table/depends/rocksdb_warpper.h"
18-
18+
#ifdef PADDLE_WITH_HETERPS
1919
namespace paddle {
2020
namespace distributed {
2121
class SSDSparseTable : public CommonSparseTable {
@@ -58,3 +58,4 @@ class SSDSparseTable : public CommonSparseTable {
5858

5959
} // namespace ps
6060
} // namespace paddle
61+
#endif

paddle/fluid/distributed/table/table.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#include "paddle/fluid/distributed/table/common_graph_table.h"
2222
#include "paddle/fluid/distributed/table/common_sparse_table.h"
2323
#include "paddle/fluid/distributed/table/sparse_geo_table.h"
24+
#ifdef PADDLE_WITH_HETERPS
2425
#include "paddle/fluid/distributed/table/ssd_sparse_table.h"
26+
#endif
2527
#include "paddle/fluid/distributed/table/tensor_accessor.h"
2628
#include "paddle/fluid/distributed/table/tensor_table.h"
2729

@@ -30,7 +32,9 @@ namespace distributed {
3032
REGISTER_PSCORE_CLASS(Table, GraphTable);
3133
REGISTER_PSCORE_CLASS(Table, CommonDenseTable);
3234
REGISTER_PSCORE_CLASS(Table, CommonSparseTable);
35+
#ifdef PADDLE_WITH_HETERPS
3336
REGISTER_PSCORE_CLASS(Table, SSDSparseTable);
37+
#endif
3438
REGISTER_PSCORE_CLASS(Table, SparseGeoTable);
3539
REGISTER_PSCORE_CLASS(Table, BarrierTable);
3640
REGISTER_PSCORE_CLASS(Table, TensorTable);

0 commit comments

Comments
 (0)