Skip to content

Commit 0f52f5f

Browse files
author
roxx30198
committed
Fix dataframe warning caused by type cast
1 parent c90eb86 commit 0f52f5f

7 files changed

Lines changed: 52 additions & 14 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ repos:
5050
hooks:
5151
- id: pydocstyle
5252
# TODO: add packages one by one to enforce pydocstyle eventually
53-
files: (^dpbench/config/|^scripts/|^dpbench/console/|^dpbench/infrastructure/benchmark_runner.py|^dpbench/infrastructure/benchmark_validation.py|
54-
^dpbench/benchmarks/rodinia)
53+
files: (^dpbench/config/|^scripts/|^dpbench/console/|^dpbench/infrastructure/benchmark_runner.py|^dpbench/infrastructure/benchmark_validation.py|^dpbench/benchmarks/rodinia)
5554
args: ["--convention=google"]
5655
# D417 does not work properly:
5756
# https://github.com/PyCQA/pydocstyle/issues/459

‎dpbench/benchmarks/rodinia/gaussian/__init__.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
"""
6-
7-
Gaussian elimination implementation
5+
"""Gaussian elimination implementation.
86
97
This is sycl and numba-dpex implementation for gaussian elimination
108

‎dpbench/benchmarks/rodinia/gaussian/gaussian_initialize.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
"""Init for gaussian ndpx and sycl implementation."""
6+
57
LAMBDA = -0.01
68

79

810
def initialize(size, types_dict):
11+
"""Initialize the input and output matrices based on size and dtype.
12+
13+
Args:
14+
size: size of the input matrices.
15+
types_dict: type.
16+
17+
"""
918
import math
1019

1120
import numpy as np

‎dpbench/benchmarks/rodinia/gaussian/gaussian_numba_dpex_k.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
"""Numba-dpex implementation for gaussian elimination."""
6+
57
import dpctl
68
import numba_dpex
79

810

911
@numba_dpex.kernel()
1012
def gaussian_kernel_1(m, a, size, t):
13+
"""Kernel to generate the multiplier."""
1114
if (
1215
numba_dpex.get_local_id(2)
1316
+ numba_dpex.get_group_id(2) * numba_dpex.get_local_size(2)
@@ -41,6 +44,7 @@ def gaussian_kernel_1(m, a, size, t):
4144

4245
@numba_dpex.kernel()
4346
def gaussian_kernel_2(m, a, b, size, t):
47+
"""Kernel to do the gaussian elimination using gaussian matrix manipulation."""
4448
if (
4549
numba_dpex.get_local_id(2)
4650
+ numba_dpex.get_group_id(2) * numba_dpex.get_local_size(2)
@@ -70,6 +74,17 @@ def gaussian_kernel_2(m, a, b, size, t):
7074

7175

7276
def gaussian(a, b, m, size, block_sizeXY, result):
77+
"""Perform the gaussian elimination on input matrix for numba_dpex.
78+
79+
Args:
80+
a: Actual matrix.
81+
b: Column matrix .
82+
m: multiplier matrix.
83+
size: size of the input matrices.
84+
block_sizeXY: block size of the 2d kernels.
85+
result: result after performing gaussian elimination.
86+
87+
"""
7388
device = dpctl.SyclDevice()
7489
block_size = device.max_work_group_size
7590
grid_size = int((size / block_size) + 0 if not (size % block_size) else 1)

‎dpbench/benchmarks/rodinia/gaussian/gaussian_python.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
"""Python serial implementation for gaussian elimination."""
45

56

67
def gaussian(a, b, m, size, block_sizeXY, result):
8+
"""Perform the gaussian elimination on input matrix in python.
9+
10+
Args:
11+
a: Actual matrix.
12+
b: Column matrix .
13+
m: multiplier matrix.
14+
size: size of the input matrices.
15+
block_sizeXY: N/A
16+
result: result after performing gaussian elimination.
17+
18+
"""
719
# Forward Elimination
820
for t in range(size - 1):
921
for i in range(t + 1, size):

‎dpbench/benchmarks/rodinia/gaussian/gaussian_sycl_native_ext/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
"""Init for gaussian sycl."""
6+
57
from .gaussian_sycl._gaussian_sycl import gaussian as gaussian_sycl
68

79
__all__ = ["gaussian_sycl"]

‎dpbench/infrastructure/reporter.py‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,24 @@ def generate_performance_report(
199199
.where(dm.Result.run_id == run_id)
200200
)
201201

202-
df = pd.read_sql_query(
203-
sql=sql,
204-
con=conn.connect(),
202+
df = (
203+
pd.read_sql_query(sql=sql, con=conn.connect())
204+
.astype({impl: "string" for impl in implementations})
205+
.fillna("n/a")
205206
)
206207

207208
for index, row in df.iterrows():
208209
for impl in implementations:
209210
time = row[impl]
210-
if time:
211-
NANOSECONDS_IN_MILISECONDS: Final[float] = 1000 * 1000.0
212-
time /= NANOSECONDS_IN_MILISECONDS
213211

214-
time = str(round(time, 2)) + "ms"
215-
else:
216-
time = "n/a"
212+
if time == "n/a":
213+
pass
214+
215+
NANOSECONDS_IN_MILISECONDS: Final[float] = 1000 * 1000.0
216+
time = float(time)
217+
time /= NANOSECONDS_IN_MILISECONDS
218+
219+
time = str(round(time, 2)) + "ms"
217220

218221
df.at[index, impl] = time
219222

0 commit comments

Comments
 (0)