diff --git a/hatchet/readers/caliper_native_reader.py b/hatchet/readers/caliper_native_reader.py index 00ebe63f..a1acebfc 100644 --- a/hatchet/readers/caliper_native_reader.py +++ b/hatchet/readers/caliper_native_reader.py @@ -167,6 +167,14 @@ def read_metrics(self, ctx="path"): elif record["cupti.activity.kind"] == "memcpy": node_label = record["cupti.activity.kind"] node_callpath = tuple(record[ctx] + [node_label]) + # rocm records + elif "rocm.activity" in record: + if record["rocm.activity"] == "KernelExecution": + node_label = record["rocm.kernel.name"] + node_callpath = tuple(record[ctx] + [node_label]) + else: + node_label = record["rocm.activity"] + node_callpath = tuple(record[ctx] + [node_label]) # Sampling elif "module#cali.sampler.pc" in record: node_label = record["source.function#cali.sampler.pc"] @@ -306,6 +314,22 @@ def _create_parent(child_node, parent_callpath): node_type = "memcpy" else: Exception("Haven't seen this activity kind yet") + # rocm records + elif "rocm.activity" in record: + if record["rocm.activity"] == "KernelExecution": + node_label = record["rocm.kernel.name"] + node_callpath = tuple(record[ctx] + [node_label]) + parent_callpath = node_callpath[:-1] + node_type = "kernel" + elif "hipMemcpy" in record["rocm.api"]: + node_label = record["rocm.activity"] + # Theres going to be an extra record at the end that we must remove + record[ctx].pop() + node_callpath = tuple(record[ctx] + [node_label]) + parent_callpath = node_callpath[:-1] + node_type = "memcpy" + else: + Exception("Haven't seen this activity kind yet") # Sampling elif "module#cali.sampler.pc" in record: node_label = record["source.function#cali.sampler.pc"] @@ -453,7 +477,7 @@ def read(self): # add missing intermediate nodes to the df_fixed_data dataframe if "mpi.rank" in df_fixed_data.columns: num_ranks = metrics["mpi.rank"].max() + 1 - rank_list = range(0, num_ranks) + rank_list = range(0, int(num_ranks)) # create a standard dict to be used for filling all missing rows default_metric_dict = {}