CUDA error? what is "error: expression must have (pointer-to-) function type&#

I got the following output when I tried to compile a program that is on the internet at DAAC (DAta Assessment Center).It merely multiplies each element of a matrix by 2 and then prints out the recorded time.
I rewrote pars of it to allow for different size matrices.

When I compiled I got these errors:

cuda_two.cu(57): error: expression must have (pointer-to-) function type

cuda_two.cu(58): error: expression must have (pointer-to-) function type

cuda_two.cu(60): error: expression must have (pointer-to-) function type

cuda_two.cu(60): error: expression must have (pointer-to-) function type

cuda_two.cu(60): error: expression must have (pointer-to-) function type

Now I do not think it is a c program error error, it must be a CUDA compiler error.

The code is:

CPU
gettimeofday(&t2_start,0);
vecMult_h(a_h,b_h,n);
gettimeofday(&t2_end,0);

time_d(repcounter) = (t1_end.tv_sec-t1_start.tv_sec)*1000000 + t1_end.tv_usec -t1_start.tv_usec;
time_h(repcounter) = (t2_end.tv_sec-t2_start.tv_sec)*1000000 + t2_end.tv_usec -t2_start.tv_usec;

n = n + n(repcounter); time_dev = time_dev + time_d(repcounter); time_host = time_host(repcounter);

n_avg = n/repcount; time_dev_avg = time_dev/repcount; time_host_avg = time_host/repcount;

}

The code in question is begins with line time_d = and ends with line n = n +n(repcounter). Those three lines and 57, 58 and 60.

What is wrong with this code and how do I fix it?

newport_j

You think wrong.

This is an absolutely elementary C programming mistake. Nothing to do with CUDA at all. The compiler is telling you it doesn’t understand your incorrect use of parentheses, and with some good reason. In C square brackets are used for array indexing. Parentheses are reserved for arithmetic expressions and to denote functions. Here the compiler thinks that time_d, time_h, time_host, and n must be functions of some sort. I am guessing they are not.

The simplest way to fix it is to go and read some elementary material about C programming.