Skip to content

Commit e7c4465

Browse files
authored
Fix several compile errors with GraphScope (#173)
1 parent 627416c commit e7c4465

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

examples/analytical_apps/pagerank/pagerank_vc_context.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616
#ifndef EXAMPLES_ANALYTICAL_APPS_PAGERANK_PAGERANK_VC_CONTEXT_H_
1717
#define EXAMPLES_ANALYTICAL_APPS_PAGERANK_PAGERANK_VC_CONTEXT_H_
1818

19+
#include "grape/grape.h"
1920
#include "grape/utils/memory_tracker.h"
2021

2122
#include <iomanip>
@@ -24,9 +25,8 @@ namespace grape {
2425

2526
template <typename FRAG_T>
2627
class PageRankVCContext : public VertexDataContext<FRAG_T, double> {
27-
using oid_t = typename FRAG_T::oid_t;
28-
2928
public:
29+
using oid_t = typename FRAG_T::oid_t;
3030
explicit PageRankVCContext(const FRAG_T& fragment)
3131
: VertexDataContext<FRAG_T, double>(fragment),
3232
master_result(this->data()) {
@@ -64,7 +64,7 @@ class PageRankVCContext : public VertexDataContext<FRAG_T, double> {
6464
#ifdef PROFILING
6565
VLOG(2) << "[frag-" << frag.fid() << "]: init degree: " << t0 << " s, "
6666
<< "calc master result: " << t1 << " s, "
67-
<< "propogate: " << t2 << " s";
67+
<< "propagate: " << t2 << " s";
6868
#endif
6969
}
7070

examples/analytical_apps/run_app_vc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void CreateAndQueryVC(const CommSpec& comm_spec, const std::string& out_prefix,
3838
graph_spec.load_concurrency = FLAGS_load_concurrency;
3939

4040
using FRAG_T =
41-
ImmutableVertexcutFragment<int64_t, grape::EmptyType, grape::EmptyType>;
41+
ImmutableVertexcutFragment<uint64_t, grape::EmptyType, grape::EmptyType>;
4242
std::shared_ptr<FRAG_T> fragment = LoadVertexcutGraph<FRAG_T>(
4343
FLAGS_efile, FLAGS_vertex_num, comm_spec, graph_spec);
4444
#ifdef TRACKING_MEMORY

grape/fragment/basic_vc_fragment_loader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class BasicVCFragmentLoader {
119119
std::vector<std::thread> scan_threads;
120120
for (int i = 0; i < load_concurrency_; ++i) {
121121
scan_threads.emplace_back(
122-
[this, &bucket_edge_num, &thread_local_bucket_edge_num](int tid) {
122+
[this, &thread_local_bucket_edge_num](int tid) {
123123
auto& vec = thread_local_bucket_edge_num[tid];
124124
vec.clear();
125125
vec.resize(bucket_num_ * bucket_num_, 0);

grape/fragment/immutable_vertexcut_fragment.h

+11-3
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@ template <typename OID_T, typename VDATA_T, typename EDATA_T>
3636
class ImmutableVertexcutFragment {};
3737

3838
template <>
39-
class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
40-
: public FragmentBase<int64_t, EmptyType, EmptyType> {
39+
class ImmutableVertexcutFragment<uint64_t, EmptyType, EmptyType>
40+
: public FragmentBase<uint64_t, EmptyType, EmptyType> {
4141
public:
42-
using oid_t = int64_t;
42+
using oid_t = uint64_t;
43+
using vid_t = uint64_t;
4344
using edata_t = EmptyType;
4445
using vdata_t = EmptyType;
46+
using vertex_t = Vertex<vid_t>;
4547
using vertices_t = VertexRange<oid_t>;
48+
using vertex_range_t = VertexRange<vid_t>;
4649
using both_vertices_t = DualVertexRange<oid_t>;
4750
using edge_t = Edge<oid_t, edata_t>;
4851
using base_t = FragmentBase<oid_t, vdata_t, edata_t>;
@@ -74,6 +77,8 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
7477
using base_t::fid_;
7578
using base_t::fnum_;
7679

80+
inline const EmptyType& GetData(const vertex_t& v) const { return data_; }
81+
7782
void Init(const CommSpec& comm_spec, int64_t vnum,
7883
std::vector<edge_t>&& edges, int bucket_num = 1,
7984
std::vector<size_t>&& bucket_edge_offsets = {}) {
@@ -146,6 +151,7 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
146151
const vertices_t& DestinationVertices() const { return dst_vertices_; }
147152
const both_vertices_t& Vertices() const { return vertices_; }
148153

154+
const vertices_t& InnerVertices() const { return master_vertices_; }
149155
const vertices_t& MasterVertices() const { return master_vertices_; }
150156

151157
#ifdef USE_EDGE_ARRAY
@@ -245,6 +251,7 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
245251
}
246252

247253
int GetBucketNum() const { return bucket_num_; }
254+
oid_t GetId(const Vertex<oid_t>& v) const { return v.GetValue(); }
248255

249256
private:
250257
void buildBucket(int thread_num) {
@@ -334,6 +341,7 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
334341
#endif
335342
int bucket_num_;
336343
std::vector<size_t> bucket_edge_offsets_;
344+
EmptyType data_;
337345
};
338346

339347
} // namespace grape

grape/vertex_map/partitioner.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ template <typename OID_T>
269269
struct VCPartitioner {};
270270

271271
template <>
272-
struct VCPartitioner<int64_t> {
273-
using vertices_t = VertexRange<int64_t>;
272+
struct VCPartitioner<uint64_t> {
273+
using oid_t = uint64_t;
274+
using vertices_t = VertexRange<oid_t>;
274275

275276
public:
276277
VCPartitioner() {}
@@ -287,11 +288,11 @@ struct VCPartitioner<int64_t> {
287288
vchunk_ = master_vchunk_ * fnum_sr_;
288289
}
289290

290-
fid_t get_edge_partition(const int64_t& src, const int64_t& dst) const {
291+
fid_t get_edge_partition(const oid_t& src, const oid_t& dst) const {
291292
return coord_to_fid(get_vertex_coord(src), get_vertex_coord(dst));
292293
}
293294

294-
fid_t get_vertex_coord(const int64_t& v) const { return v / vchunk_; }
295+
fid_t get_vertex_coord(const oid_t& v) const { return v / vchunk_; }
295296

296297
fid_t coord_to_fid(const fid_t& src, const fid_t& dst) const {
297298
return src * fnum_sr_ + dst;

0 commit comments

Comments
 (0)