VS 2005+ MatrixMul newbie question on VS2005

Hi,

I am exploring the Visual Studio 2005 environment for CUDA.
I was running the code of MatrixMul from the SDK. I clicked
MatrixMul located at:
C:\Documents and Settings\All Users\Application Data\NVIDIA
Corporation\NVIDIA CUDA SDK\projects\matrixMul
and a MV Studio 2005 window opens and on the left hand side it
shows three different files under src:

1-matrixMul.cu: This contains the main() and kernal
invocation expression

2-matrixMul_gold.cpp: This defines a function computeGold() which
is used in matrixMul.cu

3-matrixMul_kernel.cu: This defines the complete kernel (global__
voidmatrixMul( float* C, float* A, float* B, int wA, int wB)for the multiplication

I am new to VS 2005 and have been working on Linux so far. I have
following questions:

1-Why do we have three different files. Although I have understood
the purpose to some extent I am unable to understand how these
files were created.

2-I am getting the same result when I compile and run any of
these files.

3- Are these files connected to each other? How do we do this.

Basically when I go to VS 2005, I write the whole code in the same
file and is automatically saved as filename.cu (I have linked VS
2005 with CUDA SDK using CUDA_VS_Wizard aaplication). But when I
am running the project from SDK I am getting the above three
files.
Although this seems very simple questions, but since I am new to
Visual Studio I am unable to grasp it.

I shall be thankful to you for your precious time.

Thanks

As you said, matrixMul.cu contains the main method. When you launch the application, you enter the main method. The main method should call other functions which will in turn call the kernel functions located in matrixMul_kernel.cu.

matrixMul_gold often contains a CPU implementation that produces the ‘golden’ signatures (A known correct result). The results of this function are often used to compare the results of the device functions.

So all of these files get compiled into a single executable. When you run that executable, it starts to run the code in the main method. The main method will call functions defined in the other source files…

Hopefully that clears things up??

Thanks for the valuable information dear!!