@@ -304,7 +304,7 @@ def __init__(
304304 self .zeusd_sock_path = zeusd_sock_path
305305
306306 self ._client = httpx .Client (transport = httpx .HTTPTransport (uds = zeusd_sock_path ))
307- self ._url_prefix = f"http://zeusd/gpu/ { gpu_index } "
307+ self ._gpu_index = gpu_index
308308
309309 @property
310310 def supports_nonblocking_setters (self ) -> bool :
@@ -318,8 +318,12 @@ def set_power_management_limit(self, power_limit_mw: int, block: bool = True) ->
318318 return
319319
320320 resp = self ._client .post (
321- self ._url_prefix + "/set_power_limit" ,
322- json = dict (power_limit_mw = power_limit_mw , block = block ),
321+ "http://zeusd/gpu/set_power_limit" ,
322+ params = {
323+ "gpu_ids" : str (self ._gpu_index ),
324+ "power_limit_mw" : str (power_limit_mw ),
325+ "block" : "true" if block else "false" ,
326+ },
323327 )
324328 if resp .status_code != 200 :
325329 raise ZeusdError (f"Failed to set power management limit: { resp .text } " )
@@ -336,8 +340,12 @@ def reset_power_management_limit(self, block: bool = True) -> None:
336340 def set_persistence_mode (self , enabled : bool , block : bool = True ) -> None :
337341 """Set persistence mode."""
338342 resp = self ._client .post (
339- self ._url_prefix + "/set_persistence_mode" ,
340- json = dict (enabled = enabled , block = block ),
343+ "http://zeusd/gpu/set_persistence_mode" ,
344+ params = {
345+ "gpu_ids" : str (self ._gpu_index ),
346+ "enabled" : "true" if enabled else "false" ,
347+ "block" : "true" if block else "false" ,
348+ },
341349 )
342350 if resp .status_code != 200 :
343351 raise ZeusdError (f"Failed to set persistence mode: { resp .text } " )
@@ -346,31 +354,53 @@ def set_persistence_mode(self, enabled: bool, block: bool = True) -> None:
346354 def set_memory_locked_clocks (self , min_clock_mhz : int , max_clock_mhz : int , block : bool = True ) -> None :
347355 """Lock the memory clock to a specified range. Units: MHz."""
348356 resp = self ._client .post (
349- self ._url_prefix + "/set_mem_locked_clocks" ,
350- json = dict (min_clock_mhz = min_clock_mhz , max_clock_mhz = max_clock_mhz , block = block ),
357+ "http://zeusd/gpu/set_mem_locked_clocks" ,
358+ params = {
359+ "gpu_ids" : str (self ._gpu_index ),
360+ "min_clock_mhz" : str (min_clock_mhz ),
361+ "max_clock_mhz" : str (max_clock_mhz ),
362+ "block" : "true" if block else "false" ,
363+ },
351364 )
352365 if resp .status_code != 200 :
353366 raise ZeusdError (f"Failed to set memory locked clocks: { resp .text } " )
354367 logger .debug ("Took %s ms to set memory locked clocks" , resp .elapsed .microseconds / 1000 )
355368
356369 def reset_memory_locked_clocks (self , block : bool = True ) -> None :
357370 """Reset the locked memory clocks to the default."""
358- resp = self ._client .post (self ._url_prefix + "/reset_mem_locked_clocks" , json = dict (block = block ))
371+ resp = self ._client .post (
372+ "http://zeusd/gpu/reset_mem_locked_clocks" ,
373+ params = {
374+ "gpu_ids" : str (self ._gpu_index ),
375+ "block" : "true" if block else "false" ,
376+ },
377+ )
359378 if resp .status_code != 200 :
360379 raise ZeusdError (f"Failed to reset memory locked clocks: { resp .text } " )
361380
362381 def set_gpu_locked_clocks (self , min_clock_mhz : int , max_clock_mhz : int , block : bool = True ) -> None :
363382 """Lock the GPU clock to a specified range. Units: MHz."""
364383 resp = self ._client .post (
365- self ._url_prefix + "/set_gpu_locked_clocks" ,
366- json = dict (min_clock_mhz = min_clock_mhz , max_clock_mhz = max_clock_mhz , block = block ),
384+ "http://zeusd/gpu/set_gpu_locked_clocks" ,
385+ params = {
386+ "gpu_ids" : str (self ._gpu_index ),
387+ "min_clock_mhz" : str (min_clock_mhz ),
388+ "max_clock_mhz" : str (max_clock_mhz ),
389+ "block" : "true" if block else "false" ,
390+ },
367391 )
368392 if resp .status_code != 200 :
369393 raise ZeusdError (f"Failed to set GPU locked clocks: { resp .text } " )
370394
371395 def reset_gpu_locked_clocks (self , block : bool = True ) -> None :
372396 """Reset the locked GPU clocks to the default."""
373- resp = self ._client .post (self ._url_prefix + "/reset_gpu_locked_clocks" , json = dict (block = block ))
397+ resp = self ._client .post (
398+ "http://zeusd/gpu/reset_gpu_locked_clocks" ,
399+ params = {
400+ "gpu_ids" : str (self ._gpu_index ),
401+ "block" : "true" if block else "false" ,
402+ },
403+ )
374404 if resp .status_code != 200 :
375405 raise ZeusdError (f"Failed to reset GPU locked clocks: { resp .text } " )
376406
0 commit comments