Hi All,
Firstly, i'm a beginner in CUDAfy.Net programming and i have an issue when trying to copy float array in to device memory.
Here is the code :-
CudafyModule km = CudafyTranslator.Cudafy(eArchitecture.sm_11);
GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);
gpu.LoadModule(km);
float[] b = new float[size];
float[] c = new float[size];
float[] dev_b = gpu.Allocate<float>(size);
float[] dev_c = gpu.Allocate<float>(size);
gpu.LaunchAsync(size / 512, 512, 1, "AtomicKernel", dev_b, dev_c);
gpu.CopyFromDevice(dev_c, c);
and the kernel function code is :
[CudafyDummy]
public static void AtomicKernel(GThread thread, float[] b, float[] c)
{
int tid = thread.threadIdx.x + thread.blockIdx.x * thread.blockDim.x;
if (tid < N)
{
if (a[tid] == 29)
{
c[tid] = tid;
thread.atomicAdd(ref c[0], b[tid]);
}
}
}
and my device capability is 1.2 with Geforce315 and the error is :
Compilation error: fatal error C1083: Cannot open include file: 'AtomicKernel.cu': No such file or directory.
Any one can help me to solve this problem ???
thank you for all.
Comments: ** Comment from web user: EsraaShehab **
Firstly, i'm a beginner in CUDAfy.Net programming and i have an issue when trying to copy float array in to device memory.
Here is the code :-
CudafyModule km = CudafyTranslator.Cudafy(eArchitecture.sm_11);
GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);
gpu.LoadModule(km);
float[] b = new float[size];
float[] c = new float[size];
float[] dev_b = gpu.Allocate<float>(size);
float[] dev_c = gpu.Allocate<float>(size);
gpu.LaunchAsync(size / 512, 512, 1, "AtomicKernel", dev_b, dev_c);
gpu.CopyFromDevice(dev_c, c);
and the kernel function code is :
[CudafyDummy]
public static void AtomicKernel(GThread thread, float[] b, float[] c)
{
int tid = thread.threadIdx.x + thread.blockIdx.x * thread.blockDim.x;
if (tid < N)
{
if (a[tid] == 29)
{
c[tid] = tid;
thread.atomicAdd(ref c[0], b[tid]);
}
}
}
and my device capability is 1.2 with Geforce315 and the error is :
Compilation error: fatal error C1083: Cannot open include file: 'AtomicKernel.cu': No such file or directory.
Any one can help me to solve this problem ???
thank you for all.
Comments: ** Comment from web user: EsraaShehab **
I also tried CUDAfy attribute only but i have another error :
Compilation error:
nvcc warning : The 'compute_11', 'compute_12', 'compute_13', 'sm_11', 'sm_12', and 'sm_13' architectures are deprecated, and may be removed in a future release.
CUDAFYSOURCETEMP.cu