Skip to content

Commit de3decc

Browse files
author
Laxman Dhulipala
committed
Build fixes; finish upgrading to MODULE.bzl.
1 parent b3ec1e4 commit de3decc

File tree

5 files changed

+50
-48
lines changed

5 files changed

+50
-48
lines changed

.bazelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ test --test_strategy=standalone
1717
# This is needed so Bazel starts with the base workspace in its
1818
# package path.
1919

20-
2120
# By default build in C++17 mode using the Homegrown scheduler for parallelism.
2221
#build --repo_env=CC=clang++-12
2322
build --repo_env=CC=g++
24-
build --cxxopt=-std=c++17
23+
build --cxxopt=-std=c++20
2524
build --cxxopt=-mcx16 # 16 byte CAS
2625
build --cxxopt=-DHOMEGROWN # use the homegrown scheduler
2726
build --cxxopt=-DLONG # use 8 byte vertex identifiers

MODULE.bazel

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
## MODULE.bazel
2-
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
32

4-
http_archive(
5-
name = "parlaylib",
6-
sha256 = "57c177c860c5daaf963fbca9dff9d5172ec73fcdad16a713cc1af6b151c84640",
7-
strip_prefix = "parlaylib-bzlmod-2025/include/",
8-
urls = ["https://github.com/ParAlg/parlaylib/archive/refs/tags/bzlmod-2025.tar.gz"],
3+
module(
4+
name = "gbbs",
5+
version = "0.0.1",
6+
compatibility_level = 1,
97
)
108

11-
bazel_dep(
12-
name = "googletest",
13-
version = "1.11.0",
14-
repo_name = "googletest",
15-
)
9+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
10+
git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
1611

12+
bazel_dep(name = "googletest", version = "1.11.0", repo_name = "googletest")
1713
bazel_dep(name = "abseil-cpp", version = "20240116.2")
1814
bazel_dep(name = "google_benchmark", version = "1.9.4")
15+
16+
git_repository(
17+
name = "parlaylib",
18+
remote = "https://github.com/ParAlg/parlaylib.git",
19+
commit = "352f5367a6b3bd2f0c6f05882cdd02e978e349ea",
20+
strip_prefix = "include/",
21+
)

gbbs/helpers/progress_reporting.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace gbbs {
2525
// a value of 0.0 (at the very beginning of the execution of the algorithm), and
2626
// the final one reporting a value of 1.0 (at the very end of the execution of
2727
// the algorithm).
28-
using ReportProgressT = absl::AnyInvocable<void(float progress)>;
28+
using ReportProgressCallback = absl::AnyInvocable<void(float progress)>;
2929

3030
// Wrapper for a `ReportProgress` instance that's useful for algorithms with the
3131
// following structure:
@@ -50,8 +50,8 @@ class IterationProgressReporter {
5050
// step.
5151
// * `has_postprocessing`: indicates whether the algorithm has a
5252
// postprocessing step.
53-
IterationProgressReporter(ReportProgressT report_progress, int num_iterations,
54-
bool has_preprocessing = false,
53+
IterationProgressReporter(ReportProgressCallback report_progress,
54+
int num_iterations, bool has_preprocessing = false,
5555
bool has_postprocessing = false)
5656
: report_progress_(std::move(report_progress)),
5757
num_iterations_(num_iterations),
@@ -92,7 +92,7 @@ class IterationProgressReporter {
9292
absl::Status PostprocessingComplete();
9393

9494
private:
95-
/*const*/ ReportProgressT report_progress_;
95+
/*const*/ ReportProgressCallback report_progress_;
9696
const int num_iterations_;
9797
const bool has_preprocessing_;
9898
const bool has_postprocessing_;

gbbs/helpers/progress_reporting_mock.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ namespace gbbs {
1717
//
1818
// TEST_F(MyAlgorithmTest, DoesFoo) {
1919
// // Invoke method under test.
20-
// EXPECT_THAT(clusterer_.Cluster(..., MockReportProgress()),
20+
// EXPECT_THAT(clusterer_.Cluster(..., MockReportProgressCallback()),
2121
// IsOkAndHolds(...));
2222
// // Check that the progress reports were as expected.
2323
// EXPECT_THAT(GetProgressReports(), ElementsAre(0.0, 1.0));
2424
// }
2525
//
26-
// Note that because `MockReportProgress()` clears any previous progress
27-
// reports, multiple `MockReportProgress()` ... `GetProgressReports()` call
26+
// Note that because `MockReportProgressCallback()` clears any previous progress
27+
// reports, multiple `MockReportProgressCallback()` ... `GetProgressReports()` call
2828
// pairs can be used in a single test.
2929
class ReportProgressMock {
3030
public:
3131
// Returns a new ReportProgress `AnyInvocable` that records its successive
3232
// arguments in `progress_reports_`. Any previously recorded progress reports
3333
// are cleared.
34-
ReportProgressT MockReportProgress() ABSL_ATTRIBUTE_LIFETIME_BOUND {
34+
ReportProgressCallback MockReportProgressCallback() ABSL_ATTRIBUTE_LIFETIME_BOUND {
3535
progress_reports_.clear();
3636
return [this](float progress) {
3737
this->progress_reports_.push_back(progress);

gbbs/helpers/progress_reporting_test.cc

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class IterationProgressReporterTest : public ::testing::Test,
2020
using CompleteLifecycleTest = IterationProgressReporterTest;
2121

2222
TEST_F(CompleteLifecycleTest, NoPreprocessingOrPostprocessing) {
23-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/4,
23+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/4,
2424
/*has_preprocessing=*/false,
2525
/*has_postprocessing=*/false);
2626
EXPECT_OK(reporter.IterationComplete(0));
@@ -31,7 +31,7 @@ TEST_F(CompleteLifecycleTest, NoPreprocessingOrPostprocessing) {
3131
}
3232

3333
TEST_F(CompleteLifecycleTest, NoPreprocessing) {
34-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/3,
34+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/3,
3535
/*has_preprocessing=*/false,
3636
/*has_postprocessing=*/true);
3737
EXPECT_OK(reporter.IterationComplete(0));
@@ -42,7 +42,7 @@ TEST_F(CompleteLifecycleTest, NoPreprocessing) {
4242
}
4343

4444
TEST_F(CompleteLifecycleTest, NoPostprocessing) {
45-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/3,
45+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/3,
4646
/*has_preprocessing=*/true,
4747
/*has_postprocessing=*/false);
4848
EXPECT_OK(reporter.PreprocessingComplete());
@@ -53,7 +53,7 @@ TEST_F(CompleteLifecycleTest, NoPostprocessing) {
5353
}
5454

5555
TEST_F(CompleteLifecycleTest, WithPreprocessingAndPostprocessing) {
56-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/2,
56+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/2,
5757
/*has_preprocessing=*/true,
5858
/*has_postprocessing=*/true);
5959
EXPECT_OK(reporter.PreprocessingComplete());
@@ -68,7 +68,7 @@ TEST_F(CompleteLifecycleTest, WithPreprocessingAndPostprocessing) {
6868
using CompleteLifecycleEarlyTerminationTest = IterationProgressReporterTest;
6969

7070
TEST_F(CompleteLifecycleEarlyTerminationTest, NoPreprocessingOrPostprocessing) {
71-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/8,
71+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/8,
7272
/*has_preprocessing=*/false,
7373
/*has_postprocessing=*/false);
7474
EXPECT_OK(reporter.IterationComplete(0));
@@ -80,7 +80,7 @@ TEST_F(CompleteLifecycleEarlyTerminationTest, NoPreprocessingOrPostprocessing) {
8080
}
8181

8282
TEST_F(CompleteLifecycleEarlyTerminationTest, NoPreprocessing) {
83-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/7,
83+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/7,
8484
/*has_preprocessing=*/false,
8585
/*has_postprocessing=*/true);
8686
EXPECT_OK(reporter.IterationComplete(0));
@@ -94,7 +94,7 @@ TEST_F(CompleteLifecycleEarlyTerminationTest, NoPreprocessing) {
9494
}
9595

9696
TEST_F(CompleteLifecycleEarlyTerminationTest, NoPostprocessing) {
97-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/7,
97+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/7,
9898
/*has_preprocessing=*/true,
9999
/*has_postprocessing=*/false);
100100
EXPECT_OK(reporter.PreprocessingComplete());
@@ -107,7 +107,7 @@ TEST_F(CompleteLifecycleEarlyTerminationTest, NoPostprocessing) {
107107

108108
TEST_F(CompleteLifecycleEarlyTerminationTest,
109109
WithPreprocessingAndePostprocessing) {
110-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/6,
110+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/6,
111111
/*has_preprocessing=*/true,
112112
/*has_postprocessing=*/true);
113113
EXPECT_OK(reporter.PreprocessingComplete());
@@ -125,15 +125,15 @@ TEST_F(CompleteLifecycleEarlyTerminationTest,
125125
using CompleteLifecycleDoneImmediatelyTest = IterationProgressReporterTest;
126126

127127
TEST_F(CompleteLifecycleDoneImmediatelyTest, NoPreprocessingOrPostprocessing) {
128-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/8,
128+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/8,
129129
/*has_preprocessing=*/false,
130130
/*has_postprocessing=*/false);
131131
EXPECT_OK(reporter.IterationsDoneEarly());
132132
EXPECT_THAT(GetProgressReports(), ElementsAre(1.0));
133133
}
134134

135135
TEST_F(CompleteLifecycleDoneImmediatelyTest, NoPreprocessing) {
136-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/7,
136+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/7,
137137
/*has_preprocessing=*/false,
138138
/*has_postprocessing=*/true);
139139
EXPECT_OK(reporter.IterationsDoneEarly());
@@ -142,7 +142,7 @@ TEST_F(CompleteLifecycleDoneImmediatelyTest, NoPreprocessing) {
142142
}
143143

144144
TEST_F(CompleteLifecycleDoneImmediatelyTest, NoPostprocessing) {
145-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/7,
145+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/7,
146146
/*has_preprocessing=*/true,
147147
/*has_postprocessing=*/false);
148148
EXPECT_OK(reporter.PreprocessingComplete());
@@ -152,7 +152,7 @@ TEST_F(CompleteLifecycleDoneImmediatelyTest, NoPostprocessing) {
152152

153153
TEST_F(CompleteLifecycleDoneImmediatelyTest,
154154
WithPreprocessingAndPostprocessing) {
155-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/6,
155+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/6,
156156
/*has_preprocessing=*/true,
157157
/*has_postprocessing=*/true);
158158
EXPECT_OK(reporter.PreprocessingComplete());
@@ -168,7 +168,7 @@ using IterationsDoneEarlyTest = IterationProgressReporterTest;
168168
using PostprocessingCompleteTest = IterationProgressReporterTest;
169169

170170
TEST_F(ProcessCompleteTest, Disallowed) {
171-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/1,
171+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/1,
172172
/*has_preprocessing=*/false);
173173
EXPECT_THAT(reporter.PreprocessingComplete(),
174174
StatusIs(absl::StatusCode::kFailedPrecondition,
@@ -177,7 +177,7 @@ TEST_F(ProcessCompleteTest, Disallowed) {
177177
}
178178

179179
TEST_F(ProcessCompleteTest, CalledMultipleTimes) {
180-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/1,
180+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/1,
181181
/*has_preprocessing=*/true);
182182
EXPECT_OK(reporter.PreprocessingComplete());
183183
EXPECT_THAT(reporter.PreprocessingComplete(),
@@ -186,7 +186,7 @@ TEST_F(ProcessCompleteTest, CalledMultipleTimes) {
186186
}
187187

188188
TEST_F(IterationCompleteTest, PreprocessingCompleteNotCalled) {
189-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/1,
189+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/1,
190190
/*has_preprocessing=*/true);
191191
EXPECT_THAT(
192192
reporter.IterationComplete(0),
@@ -196,7 +196,7 @@ TEST_F(IterationCompleteTest, PreprocessingCompleteNotCalled) {
196196
}
197197

198198
TEST_F(IterationCompleteTest, NegativeNumIterations) {
199-
IterationProgressReporter reporter(MockReportProgress(),
199+
IterationProgressReporter reporter(MockReportProgressCallback(),
200200
/*num_iterations=*/-1,
201201
/*has_preprocessing=*/false);
202202
EXPECT_THAT(
@@ -206,7 +206,7 @@ TEST_F(IterationCompleteTest, NegativeNumIterations) {
206206
}
207207

208208
TEST_F(IterationCompleteTest, ZeroNumIterations) {
209-
IterationProgressReporter reporter(MockReportProgress(),
209+
IterationProgressReporter reporter(MockReportProgressCallback(),
210210
/*num_iterations=*/0,
211211
/*has_preprocessing=*/false);
212212
EXPECT_THAT(
@@ -216,7 +216,7 @@ TEST_F(IterationCompleteTest, ZeroNumIterations) {
216216
}
217217

218218
TEST_F(IterationCompleteTest, IterationTooSmall) {
219-
IterationProgressReporter reporter(MockReportProgress(),
219+
IterationProgressReporter reporter(MockReportProgressCallback(),
220220
/*num_iterations=*/1,
221221
/*has_preprocessing=*/false);
222222
EXPECT_THAT(reporter.IterationComplete(-1),
@@ -226,7 +226,7 @@ TEST_F(IterationCompleteTest, IterationTooSmall) {
226226
}
227227

228228
TEST_F(IterationCompleteTest, IterationTooLarge) {
229-
IterationProgressReporter reporter(MockReportProgress(),
229+
IterationProgressReporter reporter(MockReportProgressCallback(),
230230
/*num_iterations=*/2,
231231
/*has_preprocessing=*/false);
232232
EXPECT_OK(reporter.IterationComplete(0));
@@ -239,7 +239,7 @@ TEST_F(IterationCompleteTest, IterationTooLarge) {
239239
}
240240

241241
TEST_F(IterationCompleteTest, InvalidIterationValueNoPreprocessing) {
242-
IterationProgressReporter reporter(MockReportProgress(),
242+
IterationProgressReporter reporter(MockReportProgressCallback(),
243243
/*num_iterations=*/5,
244244
/*has_preprocessing=*/false);
245245
EXPECT_OK(reporter.IterationComplete(0));
@@ -251,7 +251,7 @@ TEST_F(IterationCompleteTest, InvalidIterationValueNoPreprocessing) {
251251
}
252252

253253
TEST_F(IterationCompleteTest, InvalidIterationValueWithPreprocessing) {
254-
IterationProgressReporter reporter(MockReportProgress(),
254+
IterationProgressReporter reporter(MockReportProgressCallback(),
255255
/*num_iterations=*/5,
256256
/*has_preprocessing=*/true);
257257
EXPECT_OK(reporter.PreprocessingComplete());
@@ -264,7 +264,7 @@ TEST_F(IterationCompleteTest, InvalidIterationValueWithPreprocessing) {
264264
}
265265

266266
TEST_F(IterationsDoneEarlyTest, NegativeNumIterations) {
267-
IterationProgressReporter reporter(MockReportProgress(),
267+
IterationProgressReporter reporter(MockReportProgressCallback(),
268268
/*num_iterations=*/-1,
269269
/*has_preprocessing=*/false);
270270
EXPECT_THAT(
@@ -274,7 +274,7 @@ TEST_F(IterationsDoneEarlyTest, NegativeNumIterations) {
274274
}
275275

276276
TEST_F(IterationsDoneEarlyTest, ZeroNumIterations) {
277-
IterationProgressReporter reporter(MockReportProgress(),
277+
IterationProgressReporter reporter(MockReportProgressCallback(),
278278
/*num_iterations=*/0,
279279
/*has_preprocessing=*/false);
280280
EXPECT_THAT(
@@ -284,7 +284,7 @@ TEST_F(IterationsDoneEarlyTest, ZeroNumIterations) {
284284
}
285285

286286
TEST_F(IterationsDoneEarlyTest, PreprocessingCompleteNotCalled) {
287-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/1,
287+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/1,
288288
/*has_preprocessing=*/true);
289289
EXPECT_THAT(
290290
reporter.IterationsDoneEarly(),
@@ -294,7 +294,7 @@ TEST_F(IterationsDoneEarlyTest, PreprocessingCompleteNotCalled) {
294294
}
295295

296296
TEST_F(PostprocessingCompleteTest, Disallowed) {
297-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/1,
297+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/1,
298298
/*has_preprocessing=*/false,
299299
/*has_postprocessing=*/false);
300300
EXPECT_OK(reporter.IterationComplete(0));
@@ -305,7 +305,7 @@ TEST_F(PostprocessingCompleteTest, Disallowed) {
305305
}
306306

307307
TEST_F(PostprocessingCompleteTest, CalledTooEarlyNoPreprocessing) {
308-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/1,
308+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/1,
309309
/*has_preprocessing=*/false,
310310
/*has_postprocessing=*/true);
311311
EXPECT_THAT(reporter.PostprocessingComplete(),
@@ -315,7 +315,7 @@ TEST_F(PostprocessingCompleteTest, CalledTooEarlyNoPreprocessing) {
315315
}
316316

317317
TEST_F(PostprocessingCompleteTest, CalledTooEarlyWithPreprocessing) {
318-
IterationProgressReporter reporter(MockReportProgress(), /*num_iterations=*/1,
318+
IterationProgressReporter reporter(MockReportProgressCallback(), /*num_iterations=*/1,
319319
/*has_preprocessing=*/true,
320320
/*has_postprocessing=*/true);
321321
EXPECT_OK(reporter.PreprocessingComplete());

0 commit comments

Comments
 (0)