Forum: PC-Programmierung CUDA/Stream Erfahrungen?


von Maxim (Gast)


Lesenswert?

Hat schon jemand hier mit CUDA oder Stream programmiert? Wird da eine 
komplette IDE mit Compiler geboten? Wie sieht es mit der 
Programmiersprache aus?

von Christian R. (supachris)


Lesenswert?

CUDA ist ein SDK keine IDE. Sollte sich mit z.B. Visual Studio und einer 
Programmiersprache deiner Wahl benutzen lassen.

von Timmo H. (masterfx)


Lesenswert?

Steht doch alles auf der NVidia Homepage, inkl. Codebeispielen usw.
http://www.nvidia.com/object/cuda_get.html
Von der Syntax ist es praktisch genauso wie C
Beispiel aus dem Englischen Wikipedia:

This example code in C++ loads a texture from an image into an array on
1
the GPU:
2
3
cudaArray* cu_array;
4
texture<float, 2> tex;
5
 
6
// Allocate array
7
cudaMalloc(&cu_array, cudaCreateChannelDesc<float>(), width, height);
8
 
9
// Copy image data to array
10
cudaMemcpy(cu_array, image, width*height, cudaMemcpyHostToDevice);
11
 
12
// Bind the array to the texture
13
cudaBindTexture(tex, cu_array);
14
 
15
// Run kernel
16
dim3 blockDim(16, 16, 1);
17
dim3 gridDim(width / blockDim.x, height / blockDim.y, 1);
18
kernel<<< gridDim, blockDim, 0 >>>(d_odata, width, height);
19
cudaUnbindTexture(tex);
20
 
21
__global__ void kernel(float* odata, int height, int width)
22
{
23
   unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
24
   unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
25
   float c = texfetch(tex, x, y);
26
   odata[y*width+x] = c;
27
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.