Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CudaStorage"/> class.
        /// </summary>
        /// <param name="allocator">The allocator.</param>
        /// <param name="tsContext">The ts context.</param>
        /// <param name="context">The context.</param>
        /// <param name="ElementType">Type of the element.</param>
        /// <param name="elementCount">The element count.</param>
        public CudaStorage(IAllocator allocator, TSCudaContext tsContext, CudaContext context, DType ElementType, long elementCount)
            : base(allocator, ElementType, elementCount)
        {
            this.TSContext = tsContext;
            this.context   = context;

            this.bufferHandle = tsContext.AllocatorForDevice(DeviceId).Allocate(this.ByteLength);
            this.deviceBuffer = this.bufferHandle.Pointer;
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CudaAllocator"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="deviceId">The device identifier.</param>
 public CudaAllocator(TSCudaContext context, int deviceId)
 {
     this.context  = context;
     this.deviceId = deviceId;
 }