MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / set_prealloc_config

Function set_prealloc_config

imperative/python/megengine/device.py:260–283  ·  view source on GitHub ↗

r"""Specifies how to pre-allocate from raw device allocator. Args: alignment: specifies the alignment in bytes. min_req: min request size in bytes. max_overhead: max overhead above required size in bytes. growth_factor: request size / cur allocated` devic

(
    alignment: int = 1,
    min_req: int = 32 * 1024 * 1024,
    max_overhead: int = 0,
    growth_factor=2.0,
    device_type=DeviceType.CUDA,
)

Source from the content-addressed store, hash-verified

258
259
260def set_prealloc_config(
261 alignment: int = 1,
262 min_req: int = 32 * 1024 * 1024,
263 max_overhead: int = 0,
264 growth_factor=2.0,
265 device_type=DeviceType.CUDA,
266):
267 r"""Specifies how to pre-allocate from raw device allocator.
268
269 Args:
270 alignment: specifies the alignment in bytes.
271 min_req: min request size in bytes.
272 max_overhead: max overhead above required size in bytes.
273 growth_factor: request size / cur allocated`
274 device_type: the device type
275 alignment: int:
276 min_req: int:
277 max_overhead: int:
278 """
279 assert alignment > 0
280 assert min_req > 0
281 assert max_overhead >= 0
282 assert growth_factor >= 1
283 _set_prealloc_config(alignment, min_req, max_overhead, growth_factor, device_type)
284
285
286def what_is_xpu():

Callers 2

TESTFunction · 0.85
set_prealloc_configMethod · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68