@@ -1951,10 +1951,11 @@ def test_set_stats_level():
19511951 except Exception as e :
19521952 logging .info (f"Correctly caught error for invalid stats level: { e } " )
19531953
1954- # Reset to level 0 (disabled) for cleanup
1955- cufile .set_stats_level (0 )
1954+
19561955
19571956 finally :
1957+ # Reset cuFile statistics to clear all counters
1958+ cufile .stats_reset ()
19581959 # Close cuFile driver
19591960 cufile .driver_close ()
19601961 cuda .cuDevicePrimaryCtxRelease (device )
@@ -2004,44 +2005,7 @@ def test_get_parameter_min_max_value():
20042005@pytest .mark .skipif (
20052006 cufileVersionLessThan (1150 ), reason = "cuFile parameter APIs require cuFile library version 13.0 or later"
20062007)
2007- def test_stats_start ():
2008- """Test cuFile statistics collection start."""
2009- # Initialize CUDA
2010- (err ,) = cuda .cuInit (0 )
2011- assert err == cuda .CUresult .CUDA_SUCCESS
2012-
2013- err , device = cuda .cuDeviceGet (0 )
2014- assert err == cuda .CUresult .CUDA_SUCCESS
2015-
2016- err , ctx = cuda .cuDevicePrimaryCtxRetain (device )
2017- assert err == cuda .CUresult .CUDA_SUCCESS
2018- (err ,) = cuda .cuCtxSetCurrent (ctx )
2019- assert err == cuda .CUresult .CUDA_SUCCESS
2020-
2021- # Open cuFile driver
2022- cufile .driver_open ()
2023-
2024- try :
2025- # Set statistics level first (required before starting stats)
2026- cufile .set_stats_level (1 ) # Level 1 = basic statistics
2027-
2028- # Start collecting cuFile statistics
2029- cufile .stats_start ()
2030-
2031- # Verify statistics collection is active
2032- # Note: Additional verification would require stats_get() or similar functions
2033- logging .info ("cuFile statistics collection started successfully" )
2034-
2035- finally :
2036- # Close cuFile driver
2037- cufile .driver_close ()
2038- cuda .cuDevicePrimaryCtxRelease (device )
2039-
2040-
2041- @pytest .mark .skipif (
2042- cufileVersionLessThan (1150 ), reason = "cuFile parameter APIs require cuFile library version 13.0 or later"
2043- )
2044- def test_stats_stop ():
2008+ def test_stats_start_stop ():
20452009 """Test cuFile statistics collection stop."""
20462010 # Initialize CUDA
20472011 (err ,) = cuda .cuInit (0 )
@@ -2071,6 +2035,8 @@ def test_stats_stop():
20712035 logging .info ("cuFile statistics collection stopped successfully" )
20722036
20732037 finally :
2038+ # Reset cuFile statistics to clear all counters
2039+ cufile .stats_reset ()
20742040 # Close cuFile driver
20752041 cufile .driver_close ()
20762042 cuda .cuDevicePrimaryCtxRelease (device )
@@ -2103,16 +2069,15 @@ def test_stats_reset():
21032069
21042070 cufile .stats_start ()
21052071
2106- # Reset cuFile statistics to clear all counters
2107- cufile .stats_reset ()
2108-
21092072 # Verify statistics reset completed successfully
21102073 logging .info ("cuFile statistics reset successfully" )
21112074
21122075 # Stop statistics collection
21132076 cufile .stats_stop ()
21142077
21152078 finally :
2079+ # Reset cuFile statistics to clear all counters
2080+ cufile .stats_reset ()
21162081 # Close cuFile driver
21172082 cufile .driver_close ()
21182083 cuda .cuDevicePrimaryCtxRelease (device )
0 commit comments