Hi, I am trying to create a simple CUDA program and am using the matrix multiplication sdk example as a guide, for some reason even though I can’t see a difference between the code I keep getting the error expected an expression does anyone have any idea how to solve this?
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cutil_inline.h>
#include <network_kernel.cu>
void run(int argc, char** argv);
void zero(float*, int);
extern "C"
int
main(int argc, char** argv)
{
run(argc, argv);
}
void
run(int argc, char** argv)
{
// allocate host memory for matrices A and B
unsigned int sizeOfNetwork = W * H;
unsigned int memSizeOfNetwork = sizeof(float) * sizeOfNetwork;
float* nHost = (float*) malloc(memSizeOfNetwork);
zero(nHost, sizeOfNetwork);
// Allocate memory on device
float* nDevice;
cutilSafeCall(cudaMalloc((void**) &nDevice, memSizeOfNetwork));
// copy host memory to device
cutilSafeCall(cudaMemcpy(nDevice, nHost, memSizeOfNetwork,
cudaMemcpyHostToDevice) );
unsigned int timer = 0;
cutilCheckError(cutCreateTimer(&timer));
cutilCheckError(cutStartTimer(timer));
dim3 threads(BLOCK_SIZE, BLOCK_SIZE);
dim3 grid(W / threads.x, H / threads.y);
// kernel
network<<< grid, threads >>>(nDevice, W);
// Free memory
free(nHost);
cutilSafeCall(cudaFree(nDevice));
}
void zero(float* data, int size)
{
for (int i = 0; i < size; ++i)
data[i] = 0;
}
#define BLOCK_SIZE 16
#define H = 160
#define W = 160
#define S = 25600
__global__ void
network(float* N, float* w)
{
}