MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / _float_view

Function _float_view

python/2_CoreConcepts/simpleZeroCopy/simpleZeroCopy.py:75–80  ·  view source on GitHub ↗
(host_ptr, num_floats)

Source from the content-addressed store, hash-verified

73
74
75def _float_view(host_ptr, num_floats):
76 return np.frombuffer(
77 (ctypes.c_float * num_floats).from_address(host_ptr),
78 dtype=np.float32,
79 count=num_floats,
80 )
81
82
83# CUDA C++: vector add with grid-stride loop

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected