示例#1
0
SEXP R_auto_cuMemsetD8Async(SEXP r_dstDevice, SEXP r_uc, SEXP r_N, SEXP r_hStream)
{
    SEXP r_ans = R_NilValue;
    CUdeviceptr dstDevice = REAL(r_dstDevice)[0];
    unsigned char uc = (unsigned char) INTEGER(r_uc)[0];
    size_t N = REAL(r_N)[0];
    CUstream hStream = (CUstream) getRReference(r_hStream);
    
    CUresult ans;
    ans = cuMemsetD8Async(dstDevice, uc, N, hStream);
    
    r_ans = Renum_convert_CUresult(ans) ;
    
    return(r_ans);
}
示例#2
0
static int cuda_memset(gpudata *dst, size_t dstoff, int data) {
    cuda_context *ctx = dst->ctx;

    ASSERT_BUF(dst);

    if ((dst->sz - dstoff) == 0) return GA_NO_ERROR;

    cuda_enter(ctx);

    cuda_wait(dst, CUDA_WAIT_WRITE);

    ctx->err = cuMemsetD8Async(dst->ptr + dstoff, data, dst->sz - dstoff,
                               ctx->s);
    if (ctx->err != CUDA_SUCCESS) {
      cuda_exit(ctx);
      return GA_IMPL_ERROR;
    }

    cuda_record(dst, CUDA_WAIT_WRITE);
    cuda_exit(ctx);
    return GA_NO_ERROR;
}