Unable to compile with nvcc in command line, time measurement

Hi all, I have 2 quaetions:
1)I am unable to compile my .cu files in command line with nvcc command.
Error is: nvcc fatal: cannot find compiler ‘cl.exe’

With Visual Studio 2013 I am able to build projects.

  1. How can I measure execution time of my program? Can I measure execution time of certain function, or piece of code (like tic-toc in Matlab)?

Thanks a lot.

i can help with the first, probably you have to add the enviroment varibles: http://www.computerhope.com/issues/ch000549.htm

Talking about the second question, you can use:

cudaEventCreate(&start);
cudaEventCreate(&stop);

Please tell me which environmental variable I have to change and what should I write in that variable

If you want to time C code, you can just use something like this (I use this exact syntax):

#include <time.h>
#include <stdio.h>

#define START clock_t t1; t1=clock();
#define END {long int final=clock()-t1; printf("Took %li ticks (%f seconds)", final, ((float)final)/CLOCKS_PER_SEC);}

Just put START and END in your code.