Caliper "region/activity-profile" configs will not read into thicket (duplicate index error)
@slabasan is already working on this.
Since Jun 12, 2026.
- Dominant language
- JavaScript
- Stars
- 18
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
# Description
Thicket has a built-in assumption that the profile index will be unique per node, so caliper configurations like (`rocm-activity-profile` and `cuda-activity-profile`) that generate a rank index will cause an error of the form:
```
tk = th.Thicket.from_caliperreader(files)
vvv
thicket.utils.DuplicateIndexError: Duplicate indices found in DataFrame index.
he is reading in 2 caliper files like this: tk = tt.Thicket.from_caliperreader(files, disable_tqdm=True)
```
# Workarounds
## When Just collecting runtime
The workaround, assuming that your data is actually just one rank, is to read each file individually and modify the dataframe before concatenating the thickets back together. This specific fix works for `rocm-activity-profile` and `cuda-activity-profile`:
```
for f in glob("../../data/RAJAPerf-version-2025.12.0/epyc-mi300a/1APU/rocprofiler/allkernels-rap/1073741824/32/1/**/cap-*.cali", recursive=True):
tk_roofline = tt.Thicket.from_caliperreader(f)
tk_roofline.dataframe = tk_roofline.dataframe[tk_roofline.dataframe["time (gpu)"] != 0].reset_index(level="rank", drop=True)
tk_roofline = tk_roofline.squash()
tks.append(tk_roofline)
tk_roofline = tt.Thicket.concat_thickets(tks)
```
## When also collecting counters
This is further complicated for `rocm-activity-profile`, as we sometimes also collect counters, which will be from a separate thread creating another rank row per profile row. The fix for that involves "squashing" the sparse dataframe using something like:
```
tks = []
for f in glob("../../data/RAJAPerf-version-2025.12.0/epyc-mi300a/1APU/rocprofiler/allkernels-rap/1073741824/32/1/**/cap-*.cali", recursive=True):
tk_roofline = tt.Thicket.from_caliperreader(f)
tk_roofline.dataframe = tk_roofline.dataframe[tk_roofline.dataframe["time (gpu)"] != 0].reset_index(level="rank", drop=True)
df = tk_roofline.dataframe.reset_index()
num_cols = df.select_dtypes(include="number").columns
non_num_cols = df.columns.difference(num_cols)
tk_roofline.dataframe = df.groupby("node").agg({**{c: "min" for c in num_cols},**{c: "first" for c in non_num_cols}}).drop(columns="node").reset_index().set_index(["node", "profile"])
tk_roofline = tk_roofline.squash()
tks.append(tk_roofline)
tk_roofline = tt.Thicket.concat_thickets(tks)
```
# Reproducing
This should be reproducible by reading any two activity profiles into thicket via the `from_caliperreader` API.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.