Instance Method Details

#attribute(attrib) ⇒ Object

# File 'lib/cuda/driver/deviceptr.rb', line 56defattribute(attrib)caseattribwhen:CONTEXTp=FFI::MemoryPointer.new(:CUContext)status=API::cuPointerGetAttribute(p,attrib,self.to_api)Pvt::handle_error(status,"Failed to get pointer context.")r=CUContext.send(:new,p)when:MEMORY_TYPEp=FFI::MemoryPointer.new(:uint)status=API::cuPointerGetAttribute(p,attrib,self.to_api)Pvt::handle_error(status,"Failed to get pointer memory type.")r=CUMemoryType[p.read_uint]when:DEVICE_POINTERp=FFI::MemoryPointer.new(:CUDevicePtr)status=API::cuPointerGetAttribute(p,attrib,self.to_api)Pvt::handle_error(status,"Failed to get device pointer.")r=CUDevicePtr.send(:new,p)when:HOST_POINTERp=FFI::MemoryPointer.new(:pointer)status=API::cuPointerGetAttribute(p,attrib,self.to_api)Pvt::handle_error(status,"Failed to get host pointer.")r=SGC::Memory::MemoryPointer.new(p.read_pointer)elseraiseTypeError,"Expect _attrib_ one of #{CUPointerAttribute.symbols}, but we get #{attrib}."endrend