From 29d5c6f119360ce5bb8742c97052b55abb1fdcbd Mon Sep 17 00:00:00 2001
From: Christoph Alt <christoph.alt@fau.de>
Date: Thu, 1 Aug 2024 16:12:43 +0200
Subject: [PATCH] added a test for the whitespace removement

---
 cbutil/ncu_parser.py     | 2 +-
 tests/test_ncu_parser.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cbutil/ncu_parser.py b/cbutil/ncu_parser.py
index 9af5f27..327344e 100644
--- a/cbutil/ncu_parser.py
+++ b/cbutil/ncu_parser.py
@@ -67,7 +67,7 @@ def extract_raw_counter(df: pd.DataFrame):
 
     tags["Block Size"] = df["Block Size"]
     tags["Grid Size"] = df["Grid Size"]
-    tags["GPU"] = df["device__attribute_display_name"].replace(" ", "")
+    tags["GPU"] = df["device__attribute_display_name"].str.replace(" ", "")
 
     fields[memory_write_data_key] = normalize_and_add_prefix(
         df["dram__bytes_write.sum"], "G"
diff --git a/tests/test_ncu_parser.py b/tests/test_ncu_parser.py
index ab38be6..c49460e 100644
--- a/tests/test_ncu_parser.py
+++ b/tests/test_ncu_parser.py
@@ -10,7 +10,7 @@ def sample_data():
     data = {
         ("Block Size", ""): [128, 256, 512],
         ("Grid Size", ""): [64, 128, 256],
-        ("device__attribute_display_name", ""): ["GPU1", "GPU2", "GPU3"],
+        ("device__attribute_display_name", ""): ["  GPU 1", "GPU2", "GPU 3"],
         ("dram__bytes_write.sum", "Bytes"): [1e9, 2e9, 3e9],
         ("dram__bytes_read.sum", "GBytes"): [0.5, 1., 1.5],
         ("dram__bytes_write.sum.per_second", "MByte/s"): [100, 200, 300],
-- 
GitLab