@@ -69,6 +69,7 @@ impl<'nvml> Device<'nvml> {
69
69
Only supports Linux.
70
70
*/
71
71
// Checked against local
72
+ // Tested (no-run)
72
73
#[ cfg( target_os = "linux" ) ]
73
74
#[ inline]
74
75
pub fn clear_cpu_affinity ( & mut self ) -> Result < ( ) > {
@@ -479,6 +480,7 @@ impl<'nvml> Device<'nvml> {
479
480
Only supports Linux.
480
481
*/
481
482
// Checked against local
483
+ // Tested
482
484
// TODO: Should we trim zeros here or leave it to the caller?
483
485
#[ cfg( target_os = "linux" ) ]
484
486
#[ inline]
@@ -2005,6 +2007,7 @@ impl<'nvml> Device<'nvml> {
2005
2007
Only supports Linux.
2006
2008
*/
2007
2009
// Checked against local
2010
+ // Tested
2008
2011
#[ cfg( target_os = "linux" ) ]
2009
2012
#[ inline]
2010
2013
pub fn topology_common_ancestor ( & self , other_device : Device ) -> Result < TopologyLevel > {
@@ -2250,6 +2253,7 @@ impl<'nvml> Device<'nvml> {
2250
2253
* `Unknown`, on any unexpected error
2251
2254
*/
2252
2255
// Checked against local
2256
+ // Tested
2253
2257
#[ inline]
2254
2258
pub fn is_on_same_board_as ( & self , other_device : & Device ) -> Result < bool > {
2255
2259
unsafe {
@@ -2287,6 +2291,7 @@ impl<'nvml> Device<'nvml> {
2287
2291
GeForce devices.
2288
2292
*/
2289
2293
// Checked against local
2294
+ // Tested (no-run)
2290
2295
#[ inline]
2291
2296
pub fn reset_applications_clocks ( & mut self ) -> Result < ( ) > {
2292
2297
unsafe {
@@ -2324,6 +2329,7 @@ impl<'nvml> Device<'nvml> {
2324
2329
Supports Kepler and newer fully supported devices.
2325
2330
*/
2326
2331
// Checked against local
2332
+ // Tested (no-run)
2327
2333
#[ inline]
2328
2334
pub fn set_auto_boosted_clocks ( & mut self , enabled : bool ) -> Result < ( ) > {
2329
2335
unsafe {
@@ -2351,6 +2357,7 @@ impl<'nvml> Device<'nvml> {
2351
2357
Only supports Linux.
2352
2358
*/
2353
2359
// Checked against local
2360
+ // Tested (no-run)
2354
2361
#[ cfg( target_os = "linux" ) ]
2355
2362
#[ inline]
2356
2363
pub fn set_cpu_affinity ( & mut self ) -> Result < ( ) > {
@@ -2388,10 +2395,11 @@ impl<'nvml> Device<'nvml> {
2388
2395
GeForce devices.
2389
2396
*/
2390
2397
// Checked against local
2398
+ // Tested (no-run)
2391
2399
#[ inline]
2392
2400
pub fn set_auto_boosted_clocks_default ( & mut self , enabled : bool ) -> Result < ( ) > {
2393
2401
unsafe {
2394
- // passing 0 because NVIDIA says flags are not supported yet
2402
+ // Passing 0 because NVIDIA says flags are not supported yet
2395
2403
nvml_try ( nvmlDeviceSetDefaultAutoBoostedClocksEnabled ( self . device ,
2396
2404
state_from_bool ( enabled) ,
2397
2405
0 ) )
@@ -2440,6 +2448,7 @@ impl<'nvml> Device<'nvml> {
2440
2448
Supports Kepler and newer fully supported devices.
2441
2449
*/
2442
2450
// Checked against local
2451
+ // Tested (no-run)
2443
2452
#[ inline]
2444
2453
pub fn clear_accounting_pids ( & mut self ) -> Result < ( ) > {
2445
2454
unsafe {
@@ -2618,6 +2627,7 @@ impl<'nvml> Device<'nvml> {
2618
2627
Supports Kepler and newer fully supported devices.
2619
2628
*/
2620
2629
// Checked against local
2630
+ // Tested (no-run)
2621
2631
#[ inline]
2622
2632
pub fn set_accounting ( & mut self , enabled : bool ) -> Result < ( ) > {
2623
2633
unsafe {
@@ -2650,6 +2660,7 @@ impl<'nvml> Device<'nvml> {
2650
2660
clear all other ECC counts.
2651
2661
*/
2652
2662
// Checked against local
2663
+ // Tested (no-run)
2653
2664
#[ inline]
2654
2665
pub fn clear_ecc_error_counts ( & mut self , counter_type : EccCounter ) -> Result < ( ) > {
2655
2666
unsafe {
@@ -2679,6 +2690,7 @@ impl<'nvml> Device<'nvml> {
2679
2690
Supports Kepler and newer fully supported devices.
2680
2691
*/
2681
2692
// Checked against local
2693
+ // Tested (no-run)
2682
2694
#[ inline]
2683
2695
pub fn set_api_restricted ( & mut self , api_type : Api , restricted : bool ) -> Result < ( ) > {
2684
2696
unsafe {
@@ -2720,6 +2732,7 @@ impl<'nvml> Device<'nvml> {
2720
2732
GeForce devices.
2721
2733
*/
2722
2734
// Checked against local
2735
+ // Tested (no-run)
2723
2736
#[ inline]
2724
2737
pub fn set_applications_clocks ( & mut self , mem_clock : u32 , graphics_clock : u32 ) -> Result < ( ) > {
2725
2738
unsafe {
@@ -2753,6 +2766,7 @@ impl<'nvml> Device<'nvml> {
2753
2766
* `Unknown`, on any unexpected error
2754
2767
*/
2755
2768
// Checked against local
2769
+ // Tested (no-run)
2756
2770
#[ inline]
2757
2771
pub fn set_compute_mode ( & mut self , mode : ComputeMode ) -> Result < ( ) > {
2758
2772
unsafe {
@@ -2811,6 +2825,7 @@ impl<'nvml> Device<'nvml> {
2811
2825
```
2812
2826
*/
2813
2827
// Checked against local
2828
+ // Tested (no-run)
2814
2829
#[ cfg( target_os = "windows" ) ]
2815
2830
#[ inline]
2816
2831
pub fn set_driver_model ( & mut self , model : DriverModel , flags : Behavior ) -> Result < ( ) > {
@@ -2839,6 +2854,7 @@ impl<'nvml> Device<'nvml> {
2839
2854
1.0 or higher.
2840
2855
*/
2841
2856
// Checked against local
2857
+ // Tested (no-run)
2842
2858
#[ inline]
2843
2859
pub fn set_ecc ( & mut self , enabled : bool ) -> Result < ( ) > {
2844
2860
unsafe {
@@ -2870,6 +2886,7 @@ impl<'nvml> Device<'nvml> {
2870
2886
supported on Quadro and Tesla C-class products.
2871
2887
*/
2872
2888
// Checked against local
2889
+ // Tested (no-run)
2873
2890
#[ inline]
2874
2891
pub fn set_gpu_op_mode ( & mut self , mode : OperationMode ) -> Result < ( ) > {
2875
2892
unsafe {
@@ -2899,6 +2916,7 @@ impl<'nvml> Device<'nvml> {
2899
2916
Only supports Linux.
2900
2917
*/
2901
2918
// Checked against local
2919
+ // Tested (no-run)
2902
2920
#[ cfg( target_os = "linux" ) ]
2903
2921
#[ inline]
2904
2922
pub fn set_persistent ( & mut self , enabled : bool ) -> Result < ( ) > {
@@ -2930,6 +2948,7 @@ impl<'nvml> Device<'nvml> {
2930
2948
Supports Kepler and newer fully supported devices.
2931
2949
*/
2932
2950
// Checked against local
2951
+ // Tested (no-run)
2933
2952
#[ inline]
2934
2953
pub fn set_power_management_limit ( & mut self , limit : u32 ) -> Result < ( ) > {
2935
2954
unsafe {
@@ -3395,6 +3414,15 @@ mod test {
3395
3414
assert_sync :: < Device > ( )
3396
3415
}
3397
3416
3417
+ // This modifies device state, so we don't want to actually run the test
3418
+ #[ allow( dead_code) ]
3419
+ fn clear_cpu_affinity ( ) {
3420
+ let nvml = nvml ( ) ;
3421
+ let mut device = device ( & nvml) ;
3422
+
3423
+ device. clear_cpu_affinity ( ) . unwrap ( ) ;
3424
+ }
3425
+
3398
3426
#[ test]
3399
3427
fn is_api_restricted ( ) {
3400
3428
let nvml = nvml ( ) ;
@@ -4011,6 +4039,17 @@ mod test {
4011
4039
} )
4012
4040
}
4013
4041
4042
+ // I do not have 2 devices
4043
+ #[ cfg( not( feature = "test-local" ) ) ]
4044
+ #[ test]
4045
+ fn topology_common_ancestor ( ) {
4046
+ let nvml = nvml ( ) ;
4047
+ let device1 = device ( & nvml) ;
4048
+ let device2 = nvml. device_by_index ( 1 ) . expect ( "device" ) ;
4049
+
4050
+ device1. topology_common_ancestor ( device2) . expect ( "TopologyLevel" ) ;
4051
+ }
4052
+
4014
4053
#[ cfg( target_os = "linux" ) ]
4015
4054
#[ test]
4016
4055
fn topology_nearest_gpus ( ) {
@@ -4063,6 +4102,57 @@ mod test {
4063
4102
} )
4064
4103
}
4065
4104
4105
+ // I do not have 2 devices
4106
+ #[ cfg( not( feature = "test-local" ) ) ]
4107
+ #[ test]
4108
+ fn is_on_same_board_as ( ) {
4109
+ let nvml = nvml ( ) ;
4110
+ let device1 = device ( & nvml) ;
4111
+ let device2 = nvml. device_by_index ( 1 ) . expect ( "device" ) ;
4112
+
4113
+ device1. is_on_same_board_as ( & device2) . expect ( "bool" ) ;
4114
+ }
4115
+
4116
+ // This modifies device state, so we don't want to actually run the test
4117
+ #[ allow( dead_code) ]
4118
+ #[ deny( unused_mut) ]
4119
+ fn reset_applications_clocks ( ) {
4120
+ let nvml = nvml ( ) ;
4121
+ let mut device = device ( & nvml) ;
4122
+
4123
+ device. reset_applications_clocks ( ) . expect ( "reset clocks" )
4124
+ }
4125
+
4126
+ // This modifies device state, so we don't want to actually run the test
4127
+ #[ allow( dead_code) ]
4128
+ #[ deny( unused_mut) ]
4129
+ fn set_auto_boosted_clocks ( ) {
4130
+ let nvml = nvml ( ) ;
4131
+ let mut device = device ( & nvml) ;
4132
+
4133
+ device. set_auto_boosted_clocks ( true ) . expect ( "set to true" )
4134
+ }
4135
+
4136
+ // This modifies device state, so we don't want to actually run the test
4137
+ #[ allow( dead_code) ]
4138
+ #[ deny( unused_mut) ]
4139
+ fn set_cpu_affinity ( ) {
4140
+ let nvml = nvml ( ) ;
4141
+ let mut device = device ( & nvml) ;
4142
+
4143
+ device. set_cpu_affinity ( ) . expect ( "ideal affinity set" )
4144
+ }
4145
+
4146
+ // This modifies device state, so we don't want to actually run the test
4147
+ #[ allow( dead_code) ]
4148
+ #[ deny( unused_mut) ]
4149
+ fn set_auto_boosted_clocks_default ( ) {
4150
+ let nvml = nvml ( ) ;
4151
+ let mut device = device ( & nvml) ;
4152
+
4153
+ device. set_auto_boosted_clocks_default ( true ) . expect ( "set to true" )
4154
+ }
4155
+
4066
4156
// My machine does not support this call
4067
4157
#[ cfg( not( feature = "test-local" ) ) ]
4068
4158
#[ test]
@@ -4073,6 +4163,16 @@ mod test {
4073
4163
} )
4074
4164
}
4075
4165
4166
+ // This modifies device state, so we don't want to actually run the test
4167
+ #[ allow( dead_code) ]
4168
+ #[ deny( unused_mut) ]
4169
+ fn clear_accounting_pids ( ) {
4170
+ let nvml = nvml ( ) ;
4171
+ let mut device = device ( & nvml) ;
4172
+
4173
+ device. clear_accounting_pids ( ) . expect ( "cleared" )
4174
+ }
4175
+
4076
4176
#[ test]
4077
4177
fn accounting_buffer_size ( ) {
4078
4178
let nvml = nvml ( ) ;
@@ -4112,6 +4212,107 @@ mod test {
4112
4212
} )
4113
4213
}
4114
4214
4215
+ // This modifies device state, so we don't want to actually run the test
4216
+ #[ allow( dead_code) ]
4217
+ #[ deny( unused_mut) ]
4218
+ fn set_accounting ( ) {
4219
+ let nvml = nvml ( ) ;
4220
+ let mut device = device ( & nvml) ;
4221
+
4222
+ device. set_accounting ( true ) . expect ( "set to true" )
4223
+ }
4224
+
4225
+ // This modifies device state, so we don't want to actually run the test
4226
+ #[ allow( dead_code) ]
4227
+ #[ deny( unused_mut) ]
4228
+ fn clear_ecc_error_counts ( ) {
4229
+ let nvml = nvml ( ) ;
4230
+ let mut device = device ( & nvml) ;
4231
+
4232
+ device. clear_ecc_error_counts ( EccCounter :: Aggregate ) . expect ( "set to true" )
4233
+ }
4234
+
4235
+ // This modifies device state, so we don't want to actually run the test
4236
+ #[ allow( dead_code) ]
4237
+ #[ deny( unused_mut) ]
4238
+ fn set_api_restricted ( ) {
4239
+ let nvml = nvml ( ) ;
4240
+ let mut device = device ( & nvml) ;
4241
+
4242
+ device. set_api_restricted ( Api :: ApplicationClocks , true ) . expect ( "set to true" )
4243
+ }
4244
+
4245
+ // This modifies device state, so we don't want to actually run the test
4246
+ #[ allow( dead_code) ]
4247
+ #[ deny( unused_mut) ]
4248
+ fn set_applications_clocks ( ) {
4249
+ let nvml = nvml ( ) ;
4250
+ let mut device = device ( & nvml) ;
4251
+
4252
+ device. set_applications_clocks ( 32 , 32 ) . expect ( "set to true" )
4253
+ }
4254
+
4255
+ // This modifies device state, so we don't want to actually run the test
4256
+ #[ allow( dead_code) ]
4257
+ #[ deny( unused_mut) ]
4258
+ fn set_compute_mode ( ) {
4259
+ let nvml = nvml ( ) ;
4260
+ let mut device = device ( & nvml) ;
4261
+
4262
+ device. set_compute_mode ( ComputeMode :: Default ) . expect ( "set to true" )
4263
+ }
4264
+
4265
+ // This modifies device state, so we don't want to actually run the test
4266
+ #[ cfg( target_os = "windows" ) ]
4267
+ #[ allow( dead_code) ]
4268
+ #[ deny( unused_mut) ]
4269
+ fn set_driver_model ( ) {
4270
+ let nvml = nvml ( ) ;
4271
+ let mut device = device ( & nvml) ;
4272
+
4273
+ device. set_driver_model ( EccCounter :: Aggregate ) . expect ( "set to true" )
4274
+ }
4275
+
4276
+ // This modifies device state, so we don't want to actually run the test
4277
+ #[ allow( dead_code) ]
4278
+ #[ deny( unused_mut) ]
4279
+ fn set_ecc ( ) {
4280
+ let nvml = nvml ( ) ;
4281
+ let mut device = device ( & nvml) ;
4282
+
4283
+ device. set_ecc ( true ) . expect ( "set to true" )
4284
+ }
4285
+
4286
+ // This modifies device state, so we don't want to actually run the test
4287
+ #[ allow( dead_code) ]
4288
+ #[ deny( unused_mut) ]
4289
+ fn set_gpu_op_mode ( ) {
4290
+ let nvml = nvml ( ) ;
4291
+ let mut device = device ( & nvml) ;
4292
+
4293
+ device. set_gpu_op_mode ( OperationMode :: AllOn ) . expect ( "set to true" )
4294
+ }
4295
+
4296
+ // This modifies device state, so we don't want to actually run the test
4297
+ #[ allow( dead_code) ]
4298
+ #[ deny( unused_mut) ]
4299
+ fn set_persistent ( ) {
4300
+ let nvml = nvml ( ) ;
4301
+ let mut device = device ( & nvml) ;
4302
+
4303
+ device. set_persistent ( true ) . expect ( "set to true" )
4304
+ }
4305
+
4306
+ // This modifies device state, so we don't want to actually run the test
4307
+ #[ allow( dead_code) ]
4308
+ #[ deny( unused_mut) ]
4309
+ fn set_power_management_limit ( ) {
4310
+ let nvml = nvml ( ) ;
4311
+ let mut device = device ( & nvml) ;
4312
+
4313
+ device. set_power_management_limit ( 250000 ) . expect ( "set to true" )
4314
+ }
4315
+
4115
4316
#[ cfg( target_os = "linux" ) ]
4116
4317
#[ allow( unused_variables) ]
4117
4318
#[ test]
0 commit comments