Library/ManagedCuda/CudaDNN/CudaDNNContext.cs
/// <summary>
/// This function reduces tensor A by implementing the equation C = alpha * reduce op ( A )
/// + beta* C, given tensors A and C and scaling factors alpha and beta.The reduction op
/// to use is indicated by the descriptor reduceTensorDesc.Currently-supported ops are
/// listed by the cudnnReduceTensorOp_t enum.
/// </summary>
/// <param name="reduceTensorDesc">Handle to a previously initialized reduce tensor descriptor.</param>
/// <param name="indices">Handle to a previously allocated space for writing indices.</param>
/// <param name="workspace">Handle to a previously allocated space for the reduction implementation.</param>
/// <param name="workspaceSizeInBytes">Size of the above previously allocated space.</param>
/// <param name="alpha">Pointer to scaling factor (in host memory) used to blend the source value
/// with prior value in the destination tensor as indicated by the above op equation.</param>
/// <param name="aDesc">Handle to a previously initialized tensor descriptor.</param>
/// <param name="A">Pointer to data of the tensor described by the aDesc descriptor.</param>
/// <param name="beta">Pointer to scaling factor (in host memory) used to blend the source value
/// with prior value in the destination tensor as indicated by the above op equation.</param>
/// <param name="cDesc">Handle to a previously initialized tensor descriptor.</param>
/// <param name="C">Pointer to data of the tensor described by the cDesc descriptor.</param>
This function reduces tensor A by implementing the equation C = alpha * reduce op ( A )
+ beta* C, given tensors A and C and scaling factors alpha and beta.The reduction op
to use is indicated by the descriptor reduceTensorDesc.Currently-supported ops are
listed by the cudnnReduceTensorOp_t enum.
This function reduces tensor A by implementing the equation C = alpha * reduce op ( A ) + beta * C given tensors A and C and scaling factors alpha and beta . The reduction op to use is indicated by the descriptor reduceTensorDesc . Currently - supported ops are listed by the cudnnReduceTensorOp_t enum .
public void ReduceTensor(
                                ReduceTensorDescriptor reduceTensorDesc,
                                CudaDeviceVariable<uint> indices,
                                CudaDeviceVariable<byte> workspace,
                                SizeT workspaceSizeInBytes,
                                float alpha,
                                TensorDescriptor aDesc,
                                CudaDeviceVariable<float> A,
                                float beta,
                                TensorDescriptor cDesc,
                                CudaDeviceVariable<float> C)
        {
            res = CudaDNNNativeMethods.cudnnReduceTensor(_handle,
                reduceTensorDesc.Desc, indices.DevicePointer, indices.SizeInBytes,
                workspace.DevicePointer, workspace.SizeInBytes,
                ref alpha, aDesc.Desc, A.DevicePointer, 
                ref beta, cDesc.Desc, C.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnReduceTensor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
public void ReduceTensor ( ReduceTensorDescriptor reduceTensorDesc , CudaDeviceVariable < uint > indices , CudaDeviceVariable < byte > workspace , SizeT workspaceSizeInBytes , float alpha , TensorDescriptor aDesc , CudaDeviceVariable < float > A , float beta , TensorDescriptor cDesc , CudaDeviceVariable < float > C ) { res = CudaDNNNativeMethods . cudnnReduceTensor ( _handle , reduceTensorDesc . Desc , indices . DevicePointer , indices . SizeInBytes , workspace . DevicePointer , workspace . SizeInBytes , ref alpha , aDesc . Desc , A . DevicePointer , ref beta , cDesc . Desc , C . DevicePointer ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != cudnnStatus . Success ) throw new CudaDNNException ( res ) ; }
This function reduces tensor A by implementing the equation C = alpha * reduce op ( A )
+ beta* C, given tensors A and C and scaling factors alpha and beta.The reduction op
to use is indicated by the descriptor reduceTensorDesc.Currently-supported ops are
listed by the cudnnReduceTensorOp_t enum.
This function reduces tensor A by implementing the equation C = alpha * reduce op ( A ) + beta * C given tensors A and C and scaling factors alpha and beta . The reduction op to use is indicated by the descriptor reduceTensorDesc . Currently - supported ops are listed by the cudnnReduceTensorOp_t enum .
reduceTensorDesc
ReduceTensorDescriptor
Handle to a previously initialized reduce tensor descriptor.
Handle to a previously initialized reduce tensor descriptor .
indices
CudaDeviceVariable<uint>
Handle to a previously allocated space for writing indices.
Handle to a previously allocated space for writing indices .
workspace
CudaDeviceVariable<byte>
Handle to a previously allocated space for the reduction implementation.
Handle to a previously allocated space for the reduction implementation .
workspaceSizeInBytes
SizeT
Size of the above previously allocated space.
Size of the above previously allocated space .
alpha
float
Pointer to scaling factor (in host memory) used to blend the source value
with prior value in the destination tensor as indicated by the above op equation.
Pointer to scaling factor ( in host memory ) used to blend the source value with prior value in the destination tensor as indicated by the above op equation .
aDesc
TensorDescriptor
Handle to a previously initialized tensor descriptor.
Handle to a previously initialized tensor descriptor .
A
CudaDeviceVariable<float>
Pointer to data of the tensor described by the aDesc descriptor.
Pointer to data of the tensor described by the aDesc descriptor .
beta
float
Pointer to scaling factor (in host memory) used to blend the source value
with prior value in the destination tensor as indicated by the above op equation.
Pointer to scaling factor ( in host memory ) used to blend the source value with prior value in the destination tensor as indicated by the above op equation .
cDesc
TensorDescriptor
Handle to a previously initialized tensor descriptor.
Handle to a previously initialized tensor descriptor .
C
CudaDeviceVariable<float>
Pointer to data of the tensor described by the cDesc descriptor.
Pointer to data of the tensor described by the cDesc descriptor .