Skip to content

Commit 49be89b

Browse files
committed
add tests
1 parent 94a1778 commit 49be89b

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

cuda_bindings/tests/test_cufile.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,7 @@ def test_set_get_parameter_bool():
18201820
finally:
18211821
cuda.cuDevicePrimaryCtxRelease(device)
18221822

1823+
18231824
@pytest.mark.skipif(
18241825
cufileVersionLessThan(1140), reason="cuFile parameter APIs require cuFile library version 1.14.0 or later"
18251826
)
@@ -2177,7 +2178,7 @@ def test_get_stats_l1():
21772178

21782179
# Use the exposed StatsLevel1 class from cufile module
21792180
stats = cufile.StatsLevel1()
2180-
2181+
21812182
# Get L1 statistics (basic operation counts)
21822183
cufile.get_stats_l1(stats.ptr)
21832184

@@ -2186,14 +2187,15 @@ def test_get_stats_l1():
21862187
write_ops = cufile.OpCounter.from_data(stats.write_ops)
21872188
read_bytes = int(stats.read_bytes)
21882189
write_bytes = int(stats.write_bytes)
2189-
2190+
21902191
assert read_ops.ok > 0, f"Expected read operations, got {read_ops.ok}"
21912192
assert write_ops.ok > 0, f"Expected write operations, got {write_ops.ok}"
21922193
assert read_bytes > 0, f"Expected read bytes, got {read_bytes}"
21932194
assert write_bytes > 0, f"Expected write bytes, got {write_bytes}"
21942195

2195-
logging.info(f"Stats: reads={read_ops.ok}, writes={write_ops.ok}, "
2196-
f"read_bytes={read_bytes}, write_bytes={write_bytes}")
2196+
logging.info(
2197+
f"Stats: reads={read_ops.ok}, writes={write_ops.ok}, read_bytes={read_bytes}, write_bytes={write_bytes}"
2198+
)
21972199

21982200
# Stop statistics collection
21992201
cufile.stats_stop()
@@ -2210,6 +2212,7 @@ def test_get_stats_l1():
22102212
cufile.driver_close()
22112213
cuda.cuDevicePrimaryCtxRelease(device)
22122214

2215+
22132216
@pytest.mark.skipif(
22142217
cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later"
22152218
)
@@ -2288,8 +2291,10 @@ def test_get_stats_l2():
22882291
read_ops = cufile.OpCounter.from_data(basic_stats.read_ops)
22892292
write_ops = cufile.OpCounter.from_data(basic_stats.write_ops)
22902293

2291-
logging.info(f"L2 Stats: read_hist_total={read_hist_total}, write_hist_total={write_hist_total}, "
2292-
f"basic_reads={read_ops.ok}, basic_writes={write_ops.ok}")
2294+
logging.info(
2295+
f"L2 Stats: read_hist_total={read_hist_total}, write_hist_total={write_hist_total}, "
2296+
f"basic_reads={read_ops.ok}, basic_writes={write_ops.ok}"
2297+
)
22932298

22942299
# Stop statistics collection
22952300
cufile.stats_stop()
@@ -2388,17 +2393,18 @@ def test_get_stats_l3():
23882393
# stats.per_gpu_stats has shape (1, 16), we need to get [0] first to get the (16,) array
23892394
# then slice [i:i+1] to get a 1-d array view (required by from_data)
23902395
per_gpu_array = stats.per_gpu_stats[0] # Get the (16,) array
2391-
gpu_stats = cufile.PerGpuStats.from_data(per_gpu_array[i:i+1])
2396+
gpu_stats = cufile.PerGpuStats.from_data(per_gpu_array[i : i + 1])
23922397
if gpu_stats.n_total_reads > 0 or gpu_stats.read_bytes > 0:
23932398
gpu_with_data = True
23942399
break
23952400

23962401
# L3 also contains L2 detailed stats (which includes L1 basic stats)
23972402
detailed_stats = cufile.StatsLevel2.from_data(stats.detailed)
23982403
read_hist_total = int(detailed_stats.read_size_kb_hist.sum())
2399-
2400-
logging.info(f"L3 Stats: num_gpus={num_gpus}, gpu_with_data={gpu_with_data}, "
2401-
f"detailed_read_hist={read_hist_total}")
2404+
2405+
logging.info(
2406+
f"L3 Stats: num_gpus={num_gpus}, gpu_with_data={gpu_with_data}, detailed_read_hist={read_hist_total}"
2407+
)
24022408

24032409
# Stop statistics collection
24042410
cufile.stats_stop()

0 commit comments

Comments
 (0)