Displaying 6 results from an estimated 6 matches for "cudamalloc".
2012 Jul 21
3
Use GPU in R with .Call
...= a[idx] + b[idx];
}
}
void vecAdd_kernel(double *ain,double *bin,double *cout,int len){
int alloc_size;
alloc_size=len*sizeof(double);
/*Step 0a) Make a device copies of ain,bin,and cout.*/
double *a_copy,*b_copy,*cout_copy;
/*Step 0b) Allocate memory for device copies.*/
cudaMalloc(&a_copy,alloc_size);
cudaMalloc(&b_copy,alloc_size);
cudaMalloc(&cout_copy,alloc_size);
/*Step 0c) Copy arguments to device.*/
cudaMemcpy(a_copy,ain,alloc_size,cudaMemcpyHostToDevice);
cudaMemcpy(b_copy,bin,alloc_size,cudaMemcpyHostToDevice);
cudaMemcpy(co...
2016 May 14
2
R external pointer and GPU memory leak problem
...is a R external pointer
pointing to GPU vector(device)
*/
SEXP createGPU(SEXP input, SEXP n)
{ ?
int *lenth = INTEGER(n);
? ? ? ?PROTECT (input = AS_NUMERIC (input));
? ? ? ?double * temp;?
? ? ? ?temp = REAL(input);
double *x; ? ? ? ? ? ? ? ##here is the step which causes the memory leak
cudacall(cudaMalloc((void**)&x, *lenth * sizeof(double)));
//protect the R external pointer from finalizer
SEXP ext = PROTECT(R_MakeExternalPtr(x, R_NilValue, R_NilValue));
R_RegisterCFinalizerEx(ext, _finalizer, TRUE);
?
//copying CPU to GPU
cublascall(cublasSetVector(*lenth, sizeof(double), temp, 1,?
R_ExternalP...
2012 Feb 23
0
[LLVMdev] Clang support for CUDA
...rt a simple CUDA program to LLVM IR using clang 3.0.
The program is as follows,
#include<stdio.h>
#nclude<clang/test/SemaCUDA/cuda.h>
__global__ void kernfunc(int *a)
{
*a=threadIdx.x+blockIdx.x*blockDim.x;
}
int main()
{
int *h_a,*d_a,n;
n=sizeof(int);
h_a=(int*)malloc(n);
*h_a=5;
cudaMalloc((void*)&d_a,n);
cudaMemcpy(d_a,h_a,n,cudaMemcpyHostToDevice);
kernelfunc<<<1,1>>>(d_a);
cudaMemcpy(h_a,d_a,n,cudaMemcpyDeviceToHost);
printf("%d",*h_a);
return 0;
}
What additional header files should be included? What part of the code is
currently not supported b...
2010 Nov 08
0
Segmentation Fault when using CUDA
...The simplest case of allocating a char and then deallocating causes a
segmentation fault when R closes. Not on garbage collection but only
on exit. Is there anything in the R internals that explain why this
is happening?
The relevant C++ code is
---
void gpualloctest(){
char * _a;
cudaMalloc(&_a,sizeof(char));
cudaFree(_a);
_a=NULL;
}
--- from gpu.cu
gputest<-function(){
cat("testing allocation on gpu\n")
Module('test','gputest')$gpualloctest()
cat("Test successful\n")
cat("Collecting Garbage\n&qu...
2016 Mar 05
2
instrumenting device code with gpucc
On Fri, Mar 4, 2016 at 5:50 PM, Yuanfeng Peng <yuanfeng.jack.peng at gmail.com>
wrote:
> Hi Jingyue,
>
> My name is Yuanfeng Peng, I'm a PhD student at UPenn. I'm sorry to bother
> you, but I'm having trouble with gpucc in my project, and I would be really
> grateful for your help!
>
> Currently we're trying to instrument CUDA code using LLVM 3.9, and
2016 Mar 10
4
instrumenting device code with gpucc
...ore the IR to PTX.
On Wed, Mar 9, 2016 at 4:31 PM, Yuanfeng Peng <yuanfeng.jack.peng at gmail.com>
wrote:
> Hi Jingyue,
>
> Thanks for the instructions! I instrumented the device code and got a
> binary of axpy.cu; however, the resulting executable always fails on the
> first cudaMalloc call in host code (the kernel had not even been launched
> yet), with the error code being 30 (cudaErrorUnknown). In my
> instrumentation pass, I only inserted a hook function upon each access to
> device memory, with their signatures being: "__device__ void
> _Cool_MemRead_Hook(...