def main(): #Make sure logging stuff is bootstrapped try: option_parser.parse_options() option_parser.options.no_logging = True #Don't log anything heHandle = None heAppRunner = None dcgm_structs._LoadDcgmLibrary() if g_embeddedMode: host = 0 else: #Start host engine heAppRunner = apps.NvHostEngineApp() heAppRunner.start(timeout=1000000000) time.sleep(2.0) host = "127.0.0.1" heHandle = dcgm_agent.dcgmInit() pssObj = ProcessStatsStress(g_embeddedMode, heHandle) pssObj.Run() del (pssObj) #Force destructor heAppRunner.wait() except Exception as e: raise finally: apps.AppRunner.clean_all() if heHandle is not None: dcgm_agent.dcgmShutdown()
def Unload(): ''' Unload DCGM, removing any memory it is pointing at. Use this if you really want DCGM gone from your process. Shutdown() only closes the connection/embedded host engine that was create in __init__(). ''' dcgm_agent.dcgmShutdown()
def __exit__(self, eType, value, traceback): dcgm_agent.dcgmShutdown()
## Set Config and verify the value status_handle = dcgm_agent.dcgmStatusCreate() ret = dcgm_agent.dcgmConfigSet(handle, groupId, config_values, statusHandle) errors = helper_get_status_list(status_handle) ecc_to_verify = ecc_set if len(errors) > 0: ## Possible that reset failed. Check the error codes for error in errors: if error.fieldId == dcgm_fields.DCGM_FI_DEV_ECC_CURRENT: ecc_to_verify = eccmodeOnGroupExisting #assert(ret == dcgm_structs.DCGM_ST_OK), "Failed to set configuration for the group: %s" % ret dcgm_agent.dcgmStatusClear(statusHandle) helper_verify_config_values_standalone(handle, groupId, powerLimit_set, ecc_to_verify, proc_clk_set, mem_clk_set, compute_set, syncboost_set, autoBoost_set) print "Verification Successful" ret = dcgm_agent.dcgmGroupDestroy(handle, groupId) assert (ret == dcgm_structs.DCGM_ST_OK ), "Failed to remove the test group, error: %s" % ret ret = dcgm_agent.dcgmStatusDestroy(statusHandle) assert (ret == dcgm_structs.DCGM_ST_OK ), "Failed to remove status handler, error: %s" % ret dcgm_agent.dcgmShutdown()