MCPcopy Create free account
hub / github.com/NVIDIA/DALI / __init__

Method __init__

dali/python/nvidia/dali/_multiproc/shared_queue.py:38–52  ·  view source on GitHub ↗
(self, mp, capacity)

Source from the content-addressed store, hash-verified

36 ALIGN_UP_BUFFER = 4096
37
38 def __init__(self, mp, capacity):
39 self.lock = mp.Lock()
40 self.cv_not_empty = mp.Condition(self.lock)
41 self.capacity = capacity
42 self.meta = QueueMeta(capacity, 0, 0, 0)
43 self.meta_size = align_up(self.meta.get_size(), self.ALIGN_UP_MSG)
44 dummy_msg = self.MSG_CLASS()
45 self.msg_size = align_up(dummy_msg.get_size(), self.ALIGN_UP_MSG)
46 self.shm_capacity = align_up(
47 self.meta_size + capacity * self.msg_size, self.ALIGN_UP_BUFFER
48 )
49 self.shm = shared_mem.SharedMem.allocate(self.shm_capacity)
50 self.is_closed = False
51 self._init_offsets()
52 self._write_meta()
53
54 def __getstate__(self):
55 state = self.__dict__.copy()

Callers

nothing calls this directly

Calls 6

_init_offsetsMethod · 0.95
_write_metaMethod · 0.95
QueueMetaClass · 0.85
align_upFunction · 0.85
get_sizeMethod · 0.80
allocateMethod · 0.45

Tested by

no test coverage detected