Skip to content

Commit c8597fd

Browse files
committed
Add synthetic string repro graph benchmarks
1 parent 2ac12d3 commit c8597fd

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

benchmarks/gfql/filter_pagerank/benchmark_to_cugraph_gpu.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"gplus",
3030
"synthetic_contiguous",
3131
"synthetic_offset",
32+
"synthetic_string_offset",
33+
"synthetic_string_gplus_shape",
3234
]
3335

3436
STRATEGY_CHOICES = [
@@ -41,6 +43,9 @@
4143
]
4244

4345

46+
GPLUS_SHAPE_VERTICES = 107_614
47+
48+
4449
def ensure_cached(dataset: str, data_dir: Path) -> Path:
4550
spec = dataset_spec(dataset)
4651
path = data_dir / str(spec["filename"])
@@ -103,16 +108,29 @@ def strategy_skip_reason(strategy: str, profile: Dict[str, object]) -> str | Non
103108

104109
def build_synthetic_edges(graph_kind: str, edge_count: int):
105110
import cudf # type: ignore
111+
import cupy as cp # type: ignore
112+
113+
if graph_kind == "synthetic_string_gplus_shape":
114+
start = 1_000_000
115+
base = cudf.Series(cp.arange(edge_count, dtype=cp.int32) % cp.int32(GPLUS_SHAPE_VERTICES))
116+
src = (base + start).astype("int32").astype("str")
117+
dst = ((base + 1) % GPLUS_SHAPE_VERTICES + start).astype("int32").astype("str")
118+
return cudf.DataFrame({"src": src, "dst": dst})
106119

107120
if graph_kind == "synthetic_contiguous":
108121
start = 0
109122
elif graph_kind == "synthetic_offset":
110123
start = 1_000_000
124+
elif graph_kind == "synthetic_string_offset":
125+
start = 1_000_000
111126
else:
112127
raise ValueError(f"Unsupported synthetic graph kind: {graph_kind}")
113128

114129
src = cudf.Series(range(start, start + edge_count), dtype="int32")
115130
dst = cudf.Series(range(start + 1, start + edge_count + 1), dtype="int32")
131+
if graph_kind == "synthetic_string_offset":
132+
src = src.astype("str")
133+
dst = dst.astype("str")
116134
return cudf.DataFrame({"src": src, "dst": dst})
117135

118136

0 commit comments

Comments
 (0)