Skip to content

Commit

Permalink
Fix several compile errors with GraphScope (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
siyuan0322 committed Sep 25, 2024
1 parent 627416c commit e7c4465
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
6 changes: 3 additions & 3 deletions examples/analytical_apps/pagerank/pagerank_vc_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
#ifndef EXAMPLES_ANALYTICAL_APPS_PAGERANK_PAGERANK_VC_CONTEXT_H_
#define EXAMPLES_ANALYTICAL_APPS_PAGERANK_PAGERANK_VC_CONTEXT_H_

#include "grape/grape.h"
#include "grape/utils/memory_tracker.h"

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

template <typename FRAG_T>
class PageRankVCContext : public VertexDataContext<FRAG_T, double> {
using oid_t = typename FRAG_T::oid_t;

public:
using oid_t = typename FRAG_T::oid_t;
explicit PageRankVCContext(const FRAG_T& fragment)
: VertexDataContext<FRAG_T, double>(fragment),
master_result(this->data()) {
Expand Down Expand Up @@ -64,7 +64,7 @@ class PageRankVCContext : public VertexDataContext<FRAG_T, double> {
#ifdef PROFILING
VLOG(2) << "[frag-" << frag.fid() << "]: init degree: " << t0 << " s, "
<< "calc master result: " << t1 << " s, "
<< "propogate: " << t2 << " s";
<< "propagate: " << t2 << " s";
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion examples/analytical_apps/run_app_vc.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void CreateAndQueryVC(const CommSpec& comm_spec, const std::string& out_prefix,
graph_spec.load_concurrency = FLAGS_load_concurrency;

using FRAG_T =
ImmutableVertexcutFragment<int64_t, grape::EmptyType, grape::EmptyType>;
ImmutableVertexcutFragment<uint64_t, grape::EmptyType, grape::EmptyType>;
std::shared_ptr<FRAG_T> fragment = LoadVertexcutGraph<FRAG_T>(
FLAGS_efile, FLAGS_vertex_num, comm_spec, graph_spec);
#ifdef TRACKING_MEMORY
Expand Down
2 changes: 1 addition & 1 deletion grape/fragment/basic_vc_fragment_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class BasicVCFragmentLoader {
std::vector<std::thread> scan_threads;
for (int i = 0; i < load_concurrency_; ++i) {
scan_threads.emplace_back(
[this, &bucket_edge_num, &thread_local_bucket_edge_num](int tid) {
[this, &thread_local_bucket_edge_num](int tid) {
auto& vec = thread_local_bucket_edge_num[tid];
vec.clear();
vec.resize(bucket_num_ * bucket_num_, 0);
Expand Down
14 changes: 11 additions & 3 deletions grape/fragment/immutable_vertexcut_fragment.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ template <typename OID_T, typename VDATA_T, typename EDATA_T>
class ImmutableVertexcutFragment {};

template <>
class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
: public FragmentBase<int64_t, EmptyType, EmptyType> {
class ImmutableVertexcutFragment<uint64_t, EmptyType, EmptyType>
: public FragmentBase<uint64_t, EmptyType, EmptyType> {
public:
using oid_t = int64_t;
using oid_t = uint64_t;
using vid_t = uint64_t;
using edata_t = EmptyType;
using vdata_t = EmptyType;
using vertex_t = Vertex<vid_t>;
using vertices_t = VertexRange<oid_t>;
using vertex_range_t = VertexRange<vid_t>;
using both_vertices_t = DualVertexRange<oid_t>;
using edge_t = Edge<oid_t, edata_t>;
using base_t = FragmentBase<oid_t, vdata_t, edata_t>;
Expand Down Expand Up @@ -74,6 +77,8 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
using base_t::fid_;
using base_t::fnum_;

inline const EmptyType& GetData(const vertex_t& v) const { return data_; }

void Init(const CommSpec& comm_spec, int64_t vnum,
std::vector<edge_t>&& edges, int bucket_num = 1,
std::vector<size_t>&& bucket_edge_offsets = {}) {
Expand Down Expand Up @@ -146,6 +151,7 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
const vertices_t& DestinationVertices() const { return dst_vertices_; }
const both_vertices_t& Vertices() const { return vertices_; }

const vertices_t& InnerVertices() const { return master_vertices_; }
const vertices_t& MasterVertices() const { return master_vertices_; }

#ifdef USE_EDGE_ARRAY
Expand Down Expand Up @@ -245,6 +251,7 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
}

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

private:
void buildBucket(int thread_num) {
Expand Down Expand Up @@ -334,6 +341,7 @@ class ImmutableVertexcutFragment<int64_t, EmptyType, EmptyType>
#endif
int bucket_num_;
std::vector<size_t> bucket_edge_offsets_;
EmptyType data_;
};

} // namespace grape
Expand Down
9 changes: 5 additions & 4 deletions grape/vertex_map/partitioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ template <typename OID_T>
struct VCPartitioner {};

template <>
struct VCPartitioner<int64_t> {
using vertices_t = VertexRange<int64_t>;
struct VCPartitioner<uint64_t> {
using oid_t = uint64_t;
using vertices_t = VertexRange<oid_t>;

public:
VCPartitioner() {}
Expand All @@ -287,11 +288,11 @@ struct VCPartitioner<int64_t> {
vchunk_ = master_vchunk_ * fnum_sr_;
}

fid_t get_edge_partition(const int64_t& src, const int64_t& dst) const {
fid_t get_edge_partition(const oid_t& src, const oid_t& dst) const {
return coord_to_fid(get_vertex_coord(src), get_vertex_coord(dst));
}

fid_t get_vertex_coord(const int64_t& v) const { return v / vchunk_; }
fid_t get_vertex_coord(const oid_t& v) const { return v / vchunk_; }

fid_t coord_to_fid(const fid_t& src, const fid_t& dst) const {
return src * fnum_sr_ + dst;
Expand Down

0 comments on commit e7c4465

Please sign in to comment.