Skip to content

Commit d381d0c

Browse files
committed
Fixed to pass CI.
removed replicate function definition
1 parent eccd132 commit d381d0c

16 files changed

+88
-91
lines changed

grape/graph/hashmap_indexer.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class HMIdxer {
397397
}
398398

399399
static int8_t compute_max_lookups(size_t num_buckets) {
400-
int8_t desired = hashmap_indexer_impl::log2(num_buckets);
400+
int8_t desired = ska::detailv3::log2(num_buckets);
401401
return std::max(hashmap_indexer_impl::min_lookups, desired);
402402
}
403403

@@ -412,8 +412,8 @@ class HMIdxer {
412412

413413
std::hash<KEY_T> hasher_;
414414

415-
template <typename _T>
416-
friend class sync_comm::CommImpl;
415+
template <typename _T, typename _E>
416+
friend struct sync_comm::CommImpl;
417417
};
418418

419419
template <typename KEY_T, typename INDEX_T>
@@ -576,4 +576,4 @@ struct CommImpl<HMIdxer<OID_T, VID_T>> {
576576

577577
} // namespace grape
578578

579-
#endif // GRAPE_GRAPH_HASHMAP_INDEXER_H_
579+
#endif // GRAPE_GRAPH_HASHMAP_INDEXER_H_

grape/graph/hashmap_indexer_impl.h

+1-16
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,6 @@ namespace hashmap_indexer_impl {
2929
static constexpr int8_t min_lookups = 4;
3030
static constexpr double max_load_factor = 0.5f;
3131

32-
inline int8_t log2(size_t value) {
33-
static constexpr int8_t table[64] = {
34-
63, 0, 58, 1, 59, 47, 53, 2, 60, 39, 48, 27, 54, 33, 42, 3,
35-
61, 51, 37, 40, 49, 18, 28, 20, 55, 30, 34, 11, 43, 14, 22, 4,
36-
62, 57, 46, 52, 38, 26, 32, 41, 50, 36, 17, 19, 29, 10, 13, 21,
37-
56, 45, 25, 31, 35, 16, 9, 12, 44, 24, 15, 8, 23, 7, 6, 5};
38-
value |= value >> 1;
39-
value |= value >> 2;
40-
value |= value >> 4;
41-
value |= value >> 8;
42-
value |= value >> 16;
43-
value |= value >> 32;
44-
return table[((value - (value >> 1)) * 0x07EDD5E59A4E28C2) >> 58];
45-
}
46-
4732
template <typename T>
4833
size_t vec_dump_bytes(T const& vec) {
4934
return vec.size() * sizeof(vec.front()) + sizeof(typename T::size_type);
@@ -265,4 +250,4 @@ struct CommImpl<hashmap_indexer_impl::KeyBuffer<nonstd::string_view>> {
265250

266251
} // namespace grape
267252

268-
#endif // GRAPE_GRAPH_HASHMAP_INDEXER_IMPL_H_
253+
#endif // GRAPE_GRAPH_HASHMAP_INDEXER_IMPL_H_

grape/graph/perfect_hash_indexer.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ class ImmPHIdxer {
7171
idxer_.init(buffer_.data(), buffer_.size());
7272
}
7373

74-
void Init(const char *buf, size_t size) {
75-
idxer_.init(buf, size);
76-
}
74+
void Init(const char* buf, size_t size) { idxer_.init(buf, size); }
7775

7876
size_t entry_num() const { return idxer_.entry_num(); }
7977

@@ -126,8 +124,7 @@ class PHIdxerViewBuilder {
126124
void add(KEY_T&& oid) { keys_.push_back(std::move(oid)); }
127125

128126
void buildPhf() {
129-
SinglePHFView<murmurhasher>::build(keys_.begin(),
130-
keys_.size(), phf, 1);
127+
SinglePHFView<murmurhasher>::build(keys_.begin(), keys_.size(), phf, 1);
131128
std::vector<KEY_T> ordered_keys(keys_.size());
132129
for (auto& key : keys_) {
133130
size_t idx = phf(key);
@@ -138,11 +135,14 @@ class PHIdxerViewBuilder {
138135
}
139136
}
140137

141-
void finish(void *buffer, size_t size, ImmPHIdxer<KEY_T, INDEX_T> &idxer) {
142-
external_mem_dumper dumper(buffer, size);
138+
void finish(ImmPHIdxer<KEY_T, INDEX_T>& idxer) {
139+
buildPhf();
140+
std::vector<char> buffer;
141+
buffer.resize(getSerializeSize());
142+
external_mem_dumper dumper(buffer.data(), buffer.size());
143143
phf.dump(dumper);
144144
key_buffer.dump(dumper);
145-
idxer.Init(static_cast<const char*>(dumper.buffer()), dumper.size());
145+
idxer.Init(std::move(buffer));
146146
}
147147

148148
size_t getSerializeSize() {
@@ -157,4 +157,4 @@ class PHIdxerViewBuilder {
157157

158158
} // namespace grape
159159

160-
#endif // GRAPE_GRAPH_PERFECT_HASH_INDEXER_H_
160+
#endif // GRAPE_GRAPH_PERFECT_HASH_INDEXER_H_

grape/utils/pthash_utils/ef_sequence_view.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16-
#ifndef GRAPHSCOPE_PTHASH_UTILS_EF_SEQUENCE_VIEW_VIEW_H_
17-
#define GRAPHSCOPE_PTHASH_UTILS_EF_SEQUENCE_VIEW_VIEW_H_
16+
#ifndef GRAPE_UTILS_PTHASH_UTILS_EF_SEQUENCE_VIEW_H_
17+
#define GRAPE_UTILS_PTHASH_UTILS_EF_SEQUENCE_VIEW_H_
1818

1919
#include <assert.h>
2020
#include <stddef.h>
@@ -146,4 +146,4 @@ struct ef_sequence_view {
146146

147147
} // namespace grape
148148

149-
#endif // GRAPHSCOPE_PTHASH_UTILS_EF_SEQUENCE_VIEW_VIEW_H_
149+
#endif // GRAPE_UTILS_PTHASH_UTILS_EF_SEQUENCE_VIEW_H_

grape/utils/pthash_utils/encoders_view.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16-
#ifndef GRAPHSCOPE_PTHASH_UTILS_ENCODERS_VIEW_VIEW_H_
17-
#define GRAPHSCOPE_PTHASH_UTILS_ENCODERS_VIEW_VIEW_H_
16+
#ifndef GRAPE_UTILS_PTHASH_UTILS_ENCODERS_VIEW_H_
17+
#define GRAPE_UTILS_PTHASH_UTILS_ENCODERS_VIEW_H_
1818

1919
#include "grape/utils/pthash_utils/ef_sequence_view.h"
2020

@@ -59,4 +59,4 @@ struct dual_dictionary_view {
5959

6060
} // namespace grape
6161

62-
#endif // GRAPHSCOPE_PTHASH_UTILS_ENCODERS_VIEW_VIEW_H_
62+
#endif // GRAPE_UTILS_PTHASH_UTILS_ENCODERS_VIEW_H_

grape/utils/pthash_utils/single_phf_view.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16-
#ifndef GRAPHSCOPE_PTHASH_UTILS_SINGLE_PHF_VIEW_H_
17-
#define GRAPHSCOPE_PTHASH_UTILS_SINGLE_PHF_VIEW_H_
16+
#ifndef GRAPE_UTILS_PTHASH_UTILS_SINGLE_PHF_VIEW_H_
17+
#define GRAPE_UTILS_PTHASH_UTILS_SINGLE_PHF_VIEW_H_
1818

1919
#include "grape/utils/pthash_utils/encoders_view.h"
2020
#include "pthash/builders/util.hpp"
@@ -32,14 +32,14 @@ struct mem_dumper {
3232

3333
template <typename T>
3434
void dump(const T& val) {
35-
static_assert(std::is_pod<T>::value);
35+
static_assert(std::is_pod<T>::value, "T must be POD type");
3636
const char* ptr = reinterpret_cast<const char*>(&val);
3737
buf_.insert(buf_.end(), ptr, ptr + sizeof(T));
3838
}
3939

4040
template <typename T, typename ALLOC_T>
4141
void dump_vec(const std::vector<T, ALLOC_T>& vec) {
42-
static_assert(std::is_pod<T>::value);
42+
static_assert(std::is_pod<T>::value, "T must be POD type");
4343
size_t n = vec.size();
4444
dump(n);
4545
const char* ptr = reinterpret_cast<const char*>(vec.data());
@@ -63,7 +63,7 @@ struct external_mem_dumper {
6363

6464
template <typename T>
6565
void dump(const T& val) {
66-
static_assert(std::is_pod<T>::value);
66+
static_assert(std::is_pod<T>::value, "T must be POD type");
6767
const char* ptr = reinterpret_cast<const char*>(&val);
6868
if (pos_ + sizeof(T) > size_) {
6969
return;
@@ -74,7 +74,7 @@ struct external_mem_dumper {
7474

7575
template <typename T, typename ALLOC_T>
7676
void dump_vec(const std::vector<T, ALLOC_T>& vec) {
77-
static_assert(std::is_pod<T>::value);
77+
static_assert(std::is_pod<T>::value, "T must be POD type");
7878
size_t n = vec.size();
7979
if (pos_ + sizeof(T) * n + sizeof(size_t) > size_) {
8080
return;
@@ -109,7 +109,7 @@ struct mem_loader {
109109

110110
template <typename T>
111111
void load_vec(std::vector<T>& vec) {
112-
static_assert(std::is_pod<T>::value);
112+
static_assert(std::is_pod<T>::value, "T must be POD type");
113113
size_t n;
114114
load(n);
115115
vec.resize(n);
@@ -215,4 +215,4 @@ struct SinglePHFView {
215215

216216
} // namespace grape
217217

218-
#endif // GRAPHSCOPE_PTHASH_UTILS_SINGLE_PHF_VIEW_H_
218+
#endif // GRAPE_UTILS_PTHASH_UTILS_SINGLE_PHF_VIEW_H_

grape/utils/ref_vector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ const char* decode_val(T& val, const char* buf) {
7979

8080
} // namespace grape
8181

82-
#endif // GRAPE_UTILS_REF_VECTOR_H_
82+
#endif // GRAPE_UTILS_REF_VECTOR_H_

grape/vertex_map/global_vertex_map.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class GlobalVertexMap
274274
std::unique_ptr<IOADAPTOR_T>(new IOADAPTOR_T(part_path));
275275
io_adaptor->Open();
276276

277-
indexers_[i].Deserialize(io_adaptor);
277+
indexers_[i].template Deserialize(io_adaptor);
278278
io_adaptor->Close();
279279
}
280280
}

grape/vertex_map/imm_global_vertex_map.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,4 @@ class ImmGlobalVertexMap : public VertexMapBase<OID_T, VID_T, PARTITIONER_T> {
236236

237237
} // namespace grape
238238

239-
#endif // GRAPE_VERTEX_MAP_IMM_GLOBAL_VERTEX_MAP_H_
239+
#endif // GRAPE_VERTEX_MAP_IMM_GLOBAL_VERTEX_MAP_H_

grape/vertex_map/ph_global_vertex_map.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class PHGlobalVertexMapBuilder {
4848
for (auto& k : id_set_) {
4949
builder.add(internal_oid_t(k));
5050
}
51-
vertex_map.indexers_[fid_] = builder.finish();
51+
builder.finish(vertex_map.indexers_[fid_]);
5252
const auto& buffer = vertex_map.indexers_[fid_].buffer();
5353

5454
const CommSpec& comm_spec = vertex_map.GetCommSpec();
@@ -237,4 +237,4 @@ class PHGlobalVertexMap : public VertexMapBase<OID_T, VID_T, PARTITIONER_T> {
237237

238238
} // namespace grape
239239

240-
#endif // GRAPE_VERTEX_MAP_IMM_GLOBAL_VERTEX_MAP_H_
240+
#endif // GRAPE_VERTEX_MAP_PH_GLOBAL_VERTEX_MAP_H_

grape/worker/worker.h

-3
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ class Worker {
9393
context_->Init(messages_, std::forward<Args>(args)...);
9494
processMutation();
9595

96-
int round = 0;
97-
9896
messages_.Start();
9997

10098
messages_.StartARound();
@@ -113,7 +111,6 @@ class Worker {
113111

114112
while (!messages_.ToTerminate()) {
115113
t = GetCurrentTime();
116-
round++;
117114
messages_.StartARound();
118115

119116
runIncEval();

misc/app_tests.sh

+27-27
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function RunApp() {
4343
NP=$1; shift
4444
APP=$1; shift
4545

46-
cmd="mpirun --allow-run-as-root -n ${NP} ./run_app --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e --application ${APP} --out_prefix ./extra_tests_output $@"
46+
cmd="mpirun -n ${NP} ./run_app --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e --application ${APP} --out_prefix ./extra_tests_output $@"
4747
echo ${cmd}
4848
eval ${cmd}
4949
}
@@ -116,14 +116,14 @@ function MutableFragmentTest() {
116116
NP=$1; shift
117117
APP=$1; shift
118118

119-
cmd="mpirun --allow-run-as-root -n ${NP} ./mutable_fragment_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_base --delta_efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_delta --application ${APP} --out_prefix ./extra_tests_output $@"
119+
cmd="mpirun -n ${NP} ./mutable_fragment_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_base --delta_efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_delta --application ${APP} --out_prefix ./extra_tests_output $@"
120120
echo ${cmd}
121121
eval ${cmd}
122122
}
123123

124124
function GlobalVertexMapTest() {
125125
NP=$1; shift
126-
cmd="mpirun --allow-run-as-root -n ${NP} ./vertex_map_unit_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --out_prefix ./gvm_tests_output $@"
126+
cmd="mpirun -n ${NP} ./vertex_map_unit_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --out_prefix ./gvm_tests_output $@"
127127
echo ${cmd}
128128
eval ${cmd}
129129
}
@@ -173,7 +173,7 @@ function MutableFragmentTests() {
173173
function VertexMapTest() {
174174
NP=$1; shift
175175

176-
cmd="mpirun --allow-run-as-root -n ${NP} ./vertex_map_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e --out_prefix ./extra_tests_output --sssp_source=6 $@"
176+
cmd="mpirun -n ${NP} ./vertex_map_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e --out_prefix ./extra_tests_output --sssp_source=6 $@"
177177

178178
echo ${cmd}
179179
eval ${cmd}
@@ -182,7 +182,7 @@ function VertexMapTest() {
182182
function VertexMapTestOnMutableFragment() {
183183
NP=$1; shift
184184

185-
cmd="mpirun --allow-run-as-root -n ${NP} ./vertex_map_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_base --delta_efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_delta --out_prefix ./extra_tests_output --sssp_source=6 $@"
185+
cmd="mpirun -n ${NP} ./vertex_map_tests --vfile ${GRAPE_HOME}/dataset/${GRAPH}.v --efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_base --delta_efile ${GRAPE_HOME}/dataset/${GRAPH}.e.mutable_delta --out_prefix ./extra_tests_output --sssp_source=6 $@"
186186

187187
echo ${cmd}
188188
eval ${cmd}
@@ -193,35 +193,35 @@ function VertexMapTests() {
193193

194194
GlobalVertexMapTest ${np}
195195

196-
# VertexMapTest ${np} --string_id
197-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
196+
VertexMapTest ${np} --string_id
197+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
198198

199-
# VertexMapTest ${np} --nosegmented_partition
200-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
199+
VertexMapTest ${np} --nosegmented_partition
200+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
201201

202-
# VertexMapTest ${np} --string_id --nosegmented_partition
203-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
202+
VertexMapTest ${np} --string_id --nosegmented_partition
203+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
204204

205-
# VertexMapTest ${np} --noglobal_vertex_map
206-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
205+
VertexMapTest ${np} --noglobal_vertex_map
206+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
207207

208-
# VertexMapTest ${np} --string_id --noglobal_vertex_map
209-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
208+
VertexMapTest ${np} --string_id --noglobal_vertex_map
209+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
210210

211-
# VertexMapTest ${np} --nosegmented_partition --noglobal_vertex_map
212-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
211+
VertexMapTest ${np} --nosegmented_partition --noglobal_vertex_map
212+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
213213

214-
# VertexMapTest ${np} --string_id --nosegmented_partition --noglobal_vertex_map
215-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
214+
VertexMapTest ${np} --string_id --nosegmented_partition --noglobal_vertex_map
215+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
216216

217-
# VertexMapTestOnMutableFragment ${np} --string_id
218-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
217+
VertexMapTestOnMutableFragment ${np} --string_id
218+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
219219

220-
# VertexMapTestOnMutableFragment ${np} --nosegmented_partition
221-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
220+
VertexMapTestOnMutableFragment ${np} --nosegmented_partition
221+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
222222

223-
# VertexMapTestOnMutableFragment ${np} --string_id --nosegmented_partition
224-
# ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
223+
VertexMapTestOnMutableFragment ${np} --string_id --nosegmented_partition
224+
ExactVerify ${GRAPE_HOME}/dataset/${GRAPH}-SSSP
225225
}
226226

227227
pushd ${GRAPE_HOME}/build
@@ -236,8 +236,8 @@ fi
236236
proc_list="1 $(seq 2 2 ${nproc})"
237237

238238
for np in ${proc_list}; do
239-
# BasicTests ${np}
240-
# MutableFragmentTests ${np}
239+
BasicTests ${np}
240+
MutableFragmentTests ${np}
241241
VertexMapTests ${np}
242242
done
243243

tests/vertex_map_tests.cc

-8
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,9 @@ void CreateAndQuery(const grape::CommSpec& comm_spec,
156156
} else {
157157
if (FLAGS_segmented_partition) {
158158
if (FLAGS_global_vertex_map) {
159-
// using VertexMapType =
160-
// grape::GlobalVertexMap<OID_T, VID_T,
161-
// grape::SegmentedPartitioner<OID_T>>;
162159
using VertexMapType =
163160
grape::ImmGlobalVertexMap<OID_T, VID_T,
164161
grape::SegmentedPartitioner<OID_T>>;
165-
// using VertexMapType =
166-
// grape::PHGlobalVertexMap<OID_T, VID_T,
167-
// grape::SegmentedPartitioner<OID_T>>;
168162
using FRAG_T =
169163
grape::ImmutableEdgecutFragment<OID_T, VID_T, VDATA_T, EDATA_T,
170164
load_strategy, VertexMapType>;
@@ -191,9 +185,7 @@ void CreateAndQuery(const grape::CommSpec& comm_spec,
191185
} else {
192186
graph_spec.set_rebalance(false, 0);
193187
if (FLAGS_global_vertex_map) {
194-
// using VertexMapType = grape::GlobalVertexMap<OID_T, VID_T>;
195188
using VertexMapType = grape::ImmGlobalVertexMap<OID_T, VID_T>;
196-
// using VertexMapType = grape::PHGlobalVertexMap<OID_T, VID_T>;
197189
using FRAG_T =
198190
grape::ImmutableEdgecutFragment<OID_T, VID_T, VDATA_T, EDATA_T,
199191
load_strategy, VertexMapType>;

tests/vertex_map_unit_tests.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,4 @@ int main(int argc, char** argv) {
256256
Finalize();
257257

258258
google::ShutdownGoogleLogging();
259-
}
259+
}

0 commit comments

Comments
 (0)