Пример #1
0
        void buildFromDeviceData(
            thrust::device_ptr<uint> superVerticesOffsets,
            thrust::device_ptr<uint> verticesIDs)
        {
            checkCudaErrors(
                cudaMemcpy(&(superNodesOffsets_[0]),
                           superVerticesOffsets.get(),
                           sizeof(uint) * superNodesOffsets_.size(),
                           cudaMemcpyDeviceToHost));

            checkCudaErrors(
                cudaMemcpy(&(nodes_[0]),
                           verticesIDs.get(),
                           sizeof(uint) * nodes_.size(),
                           cudaMemcpyDeviceToHost));
        }
Пример #2
0
void gemm(bool transa, bool transb, int m, int n, int k, double alpha, thrust::device_ptr<const double> A, int lda,
    thrust::device_ptr<const double> B, int ldb, double beta, thrust::device_ptr<double> C, int ldc)
{
  const cublasOperation_t ctransa = transa ? CUBLAS_OP_T : CUBLAS_OP_N;
  const cublasOperation_t ctransb = transb ? CUBLAS_OP_T : CUBLAS_OP_N;

  cublasSetStream(context::get().cublasHandle, context::get().stream);
  cublasDgemm(context::get().cublasHandle, ctransa, ctransb, m, n, k, &alpha, A.get(), lda, B.get(), ldb, &beta, C.get(), ldc);
}