2929import time
3030
3131from _version import __version__
32- from amdsmi import amdsmi_exception , amdsmi_interface
3332from amdsmi_cli_exceptions import AmdSmiInvalidParameterException , AmdSmiRequiredCommandException
3433from amdsmi_helpers import AMDSMIHelpers
3534from amdsmi_logger import AMDSMILogger
35+ from amdsmi import amdsmi_exception , amdsmi_interface
3636
3737
3838class AMDSMICommands ():
@@ -387,6 +387,8 @@ def static_gpu(self, args, multiple_devices=False, gpu=None, asic=None, bus=None
387387 args .cache = cache
388388 if process_isolation :
389389 args .process_isolation = process_isolation
390+ if partition :
391+ args .partition = partition
390392 if clock :
391393 args .clock = clock
392394 # args.clock defaults to False so if it was overwritten to empty list, that indicates that it was given as an arguments but with an empty list
@@ -396,24 +398,22 @@ def static_gpu(self, args, multiple_devices=False, gpu=None, asic=None, bus=None
396398 # Store args that are applicable to the current platform
397399 current_platform_args = ["asic" , "bus" , "vbios" , "driver" , "ras" ,
398400 "vram" , "cache" , "board" , "process_isolation" ,
399- "clock" ]
401+ "clock" , "partition" ]
400402 current_platform_values = [args .asic , args .bus , args .vbios , args .driver , args .ras ,
401403 args .vram , args .cache , args .board , args .process_isolation ,
402- args .clock ]
404+ args .clock , args . partition ]
403405
404406 self .helpers .check_required_groups ()
405407
406408 if self .helpers .is_linux () and self .helpers .is_baremetal ():
407- if partition :
408- args .partition = partition
409409 if limit :
410410 args .limit = limit
411411 if soc_pstate :
412412 args .soc_pstate = soc_pstate
413413 if xgmi_plpd :
414414 args .xgmi_plpd = xgmi_plpd
415- current_platform_args += ["ras" , "limit" , "partition" , " soc_pstate" , "xgmi_plpd" ]
416- current_platform_values += [args .ras , args .limit , args .partition , args . soc_pstate , args .xgmi_plpd ]
415+ current_platform_args += ["ras" , "limit" , "soc_pstate" , "xgmi_plpd" ]
416+ current_platform_values += [args .ras , args .limit , args .soc_pstate , args .xgmi_plpd ]
417417
418418 if self .helpers .is_linux () and not self .helpers .is_virtual_os ():
419419 if numa :
@@ -4240,7 +4240,7 @@ def set_gpu(self, args, multiple_devices=False, gpu=None, fan=None, perf_level=N
42404240 if args .compute_partition in accelerator_profiles ['profile_types' ]:
42414241 compute_partition = amdsmi_interface .AmdSmiComputePartitionType [args .compute_partition ]
42424242 index = accelerator_profiles ['profile_types' ].index (args .compute_partition )
4243- attempted_to_set = f"Attempted to set accelerator partition to { args .compute_partition } (profile #{ accelerator_profiles ['profile_indices' ][int (index )]} on { gpu_string } "
4243+ attempted_to_set = f"Attempted to set accelerator partition to { args .compute_partition } (profile #{ accelerator_profiles ['profile_indices' ][int (index )]} ) on { gpu_string } "
42444244 amdsmi_interface .amdsmi_set_gpu_compute_partition (args .gpu , compute_partition )
42454245 self .logger .store_output (args .gpu , 'accelerator_partition' , f"Successfully set accelerator partition to { args .compute_partition } (profile #{ accelerator_profiles ['profile_indices' ][int (index )]} )" )
42464246 elif args .compute_partition in accelerator_profiles ['profile_indices' ]:
@@ -4294,7 +4294,7 @@ def set_gpu(self, args, multiple_devices=False, gpu=None, fan=None, perf_level=N
42944294
42954295 threads = []
42964296 k140secs = 140
4297- string_out = f"Updating memory partition for gpu { gpu_id } "
4297+ string_out = f"Updating memory partition for GPU: { gpu_id } "
42984298 timesToRetryRestartErr = 1
42994299
43004300 self .helpers .increment_set_count ()
@@ -4305,9 +4305,9 @@ def set_gpu(self, args, multiple_devices=False, gpu=None, fan=None, perf_level=N
43054305 while timesToRetryRestartErr >= 0 :
43064306 timesToRetryRestartErr -= 1
43074307 try :
4308- if showProgressBar : # only show reload warning on 1st set
4308+ if showProgressBar : # we want to overwrite the previous progress bar
43094309 t1 = multiprocessing .Process (target = self .helpers .showProgressbar ,
4310- args = (string_out , k140secs ,))
4310+ args = (string_out , k140secs , True ,))
43114311 threads .append (t1 )
43124312 t1 .start ()
43134313 memory_partition = amdsmi_interface .AmdSmiMemoryPartitionType [args .memory_partition ]
@@ -4342,7 +4342,7 @@ def set_gpu(self, args, multiple_devices=False, gpu=None, fan=None, perf_level=N
43424342 return
43434343 if e .get_error_code () == amdsmi_interface .amdsmi_wrapper .AMDSMI_STATUS_AMDGPU_RESTART_ERR :
43444344 # Try again on a failure -> work around for not being able to close libdrm
4345- string_out = f"Trying again - Updating memory partition for gpu { gpu_id } "
4345+ string_out = f"Trying again - Updating memory partition for GPU: { gpu_id } "
43464346 for thread in threads :
43474347 thread .terminate ()
43484348 thread .join ()
0 commit comments