示例#1
0
    static void Main()
    {
        cuda   = new CUDA(true);
        cublas = new CUBLAS(cuda);
        //allocate vector on cuda device in main thread
        CudaManager.CallMethod(AllocateVectors);
        //changing first vector from other thread
        Thread changeThread = new Thread(ChangeVectorOnDevice_ThreadRun)
        {
            IsBackground = false
        };

        changeThread.Start();
        //wait for changeThread to finish
        autoResetEvent.WaitOne();
        //getting vector from device in another one thread
        Thread getThread = new Thread(GetVectorFromDevice_ThreadRun)
        {
            IsBackground = false
        };

        getThread.Start();
        //wait for getThread to finish
        autoResetEvent.WaitOne();
        Console.WriteLine("({0}, {1}, {2}, {3}, {4})", vector2[0], vector2[1], vector2[2], vector2[3], vector2[4]);
        Console.ReadKey(true);
    }
示例#2
0
 public Network(Worker worker)
 {
     _worker         = worker;
     _cudnn          = new CUDNN(_worker);
     _cublas         = new CUBLAS(_worker);
     _srcTensorDesc  = new CUDNNTensorDescriptor();
     _dstTensorDesc  = new CUDNNTensorDescriptor();
     _biasTensorDesc = new CUDNNTensorDescriptor();
     _filterDesc     = new CUDNNFilterDescriptor();
     _convDesc       = new CUDNNConvolutionDescriptor();
     _poolingDesc    = new CUDNNPoolingDescriptor();
 }
示例#3
0
 public Network(Worker worker)
 {
     _worker = worker;
     _cudnn = new CUDNN(_worker);
     _cublas = new CUBLAS(_worker);
     _srcTensorDesc = new CUDNNTensorDescriptor();
     _dstTensorDesc = new CUDNNTensorDescriptor();
     _biasTensorDesc = new CUDNNTensorDescriptor();
     _filterDesc = new CUDNNFilterDescriptor();
     _convDesc = new CUDNNConvolutionDescriptor();
     _poolingDesc = new CUDNNPoolingDescriptor();
 }