"out of memory" runtime error in Cuda By Example codes

I am new to learning GPU parallel computing and am following the examples in the book Cuda By Example. I tried running a couple of simple programs from chapter 4 and 5 but it resulted in a runtime error. e.g. in running the executable file from nvcc add_loop_long_blocks.cu:

bash-3.2$ nvcc add_loop_long_blocks.cu
bash-3.2$ ./a.out
out of memory in add_loop_long_blocks.cu at line 39

I have a Macbook Pro with 2.3 GHz Intel Core i7, 8GB Ram, and NVIDIA GeForce GT 650M. Any pointers how to resolve this would be appreciated!

It may be that CUDA is not running correctly on your machine. Have you built and successfully run any of the sample code (like vectorAdd) as described in the CUDA getting started guide for MacOS ?