MCPcopy Index your code
hub / github.com/dmlc/dgl / empty_shared_mem

Function empty_shared_mem

python/dgl/_ffi/ndarray.py:142–181  ·  view source on GitHub ↗

Create an empty array with shared memory given shape and dtype Parameters ---------- name : string The name of the shared memory. It's a file name in Unix. is_create : bool Whether to create the shared memory or use the one created by somewhere else. shape : tu

(name, is_create, shape, dtype="float32")

Source from the content-addressed store, hash-verified

140
141
142def empty_shared_mem(name, is_create, shape, dtype="float32"):
143 """Create an empty array with shared memory given shape and dtype
144
145 Parameters
146 ----------
147 name : string
148 The name of the shared memory. It's a file name in Unix.
149
150 is_create : bool
151 Whether to create the shared memory or use the one created by somewhere else.
152
153 shape : tuple of int
154 The shape of the array
155
156 dtype : type or str
157 The data type of the array.
158
159 Returns
160 -------
161 arr : dgl.nd.NDArray
162 The array dgl supported.
163 """
164 name = ctypes.c_char_p(name.encode("utf-8"))
165 shape = c_array(dgl_shape_index_t, shape)
166 ndim = ctypes.c_int(len(shape))
167 handle = DGLArrayHandle()
168 dtype = DGLDataType(dtype)
169 check_call(
170 _LIB.DGLArrayAllocSharedMem(
171 name,
172 shape,
173 ndim,
174 ctypes.c_int(dtype.type_code),
175 ctypes.c_int(dtype.bits),
176 ctypes.c_int(dtype.lanes),
177 is_create,
178 ctypes.byref(handle),
179 )
180 )
181 return _make_array(handle, False)
182
183
184def from_dlpack(dltensor):

Callers 13

shared_memoryMethod · 0.85
get_shared_mem_arrayFunction · 0.85
create_shared_mem_arrayFunction · 0.85
_copy_data_to_shared_memFunction · 0.85
_get_shared_mem_ndataFunction · 0.85
_get_shared_mem_edataFunction · 0.85
process_requestMethod · 0.85
init_dataMethod · 0.85
init_dataMethod · 0.85
map_shared_dataMethod · 0.85
_to_shared_memFunction · 0.85

Calls 5

c_arrayFunction · 0.85
DGLDataTypeClass · 0.85
check_callFunction · 0.85
_make_arrayFunction · 0.85
encodeMethod · 0.45

Tested by

no test coverage detected