Method: OpenCL.svm_alloc
- Defined in:
- lib/opencl_ruby_ffi/SVM.rb
.svm_alloc(context, size, options = {}) ⇒ Object
Creates an SVMPointer pointing to an SVM area of memory
Attributes
-
context- the Context in which to allocate the memory -
size- the size of the mmemory area to allocate -
options- a hash containing named options
Options
-
:alignment- imposes the minimum alignment in byte
51 52 53 54 55 56 57 58 59 |
# File 'lib/opencl_ruby_ffi/SVM.rb', line 51 def self.svm_alloc(context, size, = {}) error_check(INVALID_OPERATION) if context.platform.version_number < 2.0 flags = get_flags() alignment = 0 alignment = [:alignment] if [:alignment] ptr = clSVMAlloc( context, flags, size, alignment ) error_check(MEM_OBJECT_ALLOCATION_FAILURE) if ptr.null? return SVMPointer::new( ptr.slice(0, size), context ) end |