/** * * Feladat: Adatok inicializálása a GPU-n. * - külön függvényben * - vagy direkt konstans-ként * */ #include "cuda_runtime.h" #include "device_launch_parameters.h" #include #define N 10 __global__ void addKernel(int* a, int* b, int* c); int main(int argc, char** argv) { int i; int a[N]; int b[N]; int c[N]; int* dev_a; int* dev_b; int* dev_c; cudaMalloc((void**)&dev_a, N * sizeof(int)); cudaMalloc((void**)&dev_b, N * sizeof(int)); cudaMalloc((void**)&dev_c, N * sizeof(int)); for(i=0; i>>(dev_a, dev_b, dev_c); cudaMemcpy(c, dev_c, N*sizeof(int), cudaMemcpyDeviceToHost); for(i=0; i