MCPcopy Create free account
hub / github.com/alibaba/GraphScope / main

Function main

analytical_engine/test/graphx_loader_test.cc:72–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int main(int argc, char** argv) {
73 if (argc != 2) {
74 printf("usage: ./graphx_loader_test <ipc_socket>\n");
75 return 1;
76 }
77 int index = 1;
78 std::string ipc_socket = std::string(argv[index++]);
79
80 vineyard::Client client;
81 VINEYARD_CHECK_OK(client.Connect(ipc_socket));
82
83 LOG(INFO) << "Connected to IPCServer: " << ipc_socket;
84
85 grape::InitMPIComm();
86
87 int vertices_num = 5;
88 int edges_num = 4;
89 vineyard::ObjectID arrow_frag_id;
90 grape::CommSpec comm_spec;
91 comm_spec.Init(MPI_COMM_WORLD);
92 gs::GraphXPartitioner<int64_t> partitioner;
93 std::vector<int> pid2Fid;
94 for (grape::fid_t i = 0; i < comm_spec.fnum(); ++i) {
95 pid2Fid.push_back(i);
96 }
97 partitioner.Init(pid2Fid);
98 {
99 std::vector<int64_t> oids, vdatas, src_oids, dst_oids, edatas;
100 initVerticesEdges(comm_spec.fid(), comm_spec.fnum(), vertices_num, oids,
101 src_oids, dst_oids);
102 initLongData(vdatas, vertices_num);
103 initLongData(edatas, edges_num);
104 LOG(INFO) << "Finish init data";
105 gs::GraphXRawDataBuilder<int64_t, uint64_t, int64_t, int64_t> builder(
106 client, oids, vdatas, src_oids, dst_oids, edatas);
107 auto res = builder.MySeal(client);
108 LOG(INFO) << "Built raw data: " << res->id()
109 << ", edge num: " << res->GetEdgeNum()
110 << ", vertex num: " << res->GetVertexNum();
111
112 gs::GraphXLoader<int64_t, uint64_t, int64_t, int64_t> loader(
113 res->id(), client, comm_spec, partitioner);
114 arrow_frag_id = boost::leaf::try_handle_all(
115 [&loader]() { return loader.LoadFragment(); },
116 [](const vineyard::GSError& e) {
117 LOG(FATAL) << e.error_msg;
118 return 0;
119 },
120 [](const boost::leaf::error_info& unmatched) {
121 LOG(FATAL) << "Unmatched error " << unmatched;
122 return 0;
123 });
124 }
125 LOG(INFO) << "Got pritive arrow fragment id: " << arrow_frag_id;
126 {
127 std::vector<int64_t> oids, src_oids, dst_oids;
128 std::vector<char> vdata_buffer, edata_buffer;
129 std::vector<int32_t> vdata_offset, edata_offset;

Callers

nothing calls this directly

Calls 12

initVerticesEdgesFunction · 0.85
initLongDataFunction · 0.85
initStringDataFunction · 0.85
InitMethod · 0.65
fnumMethod · 0.65
push_backMethod · 0.65
fidMethod · 0.65
idMethod · 0.65
MySealMethod · 0.45
GetEdgeNumMethod · 0.45
GetVertexNumMethod · 0.45
LoadFragmentMethod · 0.45

Tested by

no test coverage detected