MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / dumpDict

Method dumpDict

tools/CrossStackProfiler/CspFileReader.py:318–337  ·  view source on GitHub ↗
(
        self, data, name, groupId, gpuId, pretty=False, tmpPath="./tmp"
    )

Source from the content-addressed store, hash-verified

316 )
317
318 def dumpDict(
319 self, data, name, groupId, gpuId, pretty=False, tmpPath="./tmp"
320 ):
321 self._lock.acquire()
322 if not os.path.exists(tmpPath):
323 os.makedirs(tmpPath)
324 self._lock.release()
325 if pretty:
326 jsObj = json.dumps(data, indent=4, separators=(',', ': '))
327 else:
328 jsObj = json.dumps(data, separators=(',', ':'))
329
330 fileName = self.getFileName(name, groupId, gpuId, tmpPath)
331 if os.path.isfile(fileName):
332 os.remove(fileName)
333
334 fileObject = open(fileName, 'w')
335 fileObject.write(jsObj)
336 fileObject.close()
337 self._logger.info(f"dump [{fileName}] successfully!")
338
339
340def getLogger():

Callers 3

dumpOpInfoDictMethod · 0.95
dumpDCGMDictMethod · 0.95

Calls 8

getFileNameMethod · 0.95
acquireMethod · 0.80
existsMethod · 0.80
releaseMethod · 0.45
removeMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected