Installation of CAFFE with pre-installed CUDA

We have Ubuntu 12.04 LTS,
RAM-48 GB DDR3 ,
Processor-Intel Xeon®CPU E5-2620 v2@2.10GHz X17,
OS type-64 bit,
Disk-1TB.
CUDA Description
Device1-Tesla K40C
Device2-Quadro K600
Please suggest the steps to install Caffe with these configurations.