I see many torch codes use:
require cudnn
require cunn
require cutorch
What are these package used for? What is their relation with Cuda?
All 3 are used for CUDA GPU implementations for torch7.
cutorch is the cuda backend for torch7, offering various support for CUDA implementations in torch, such as a CudaTensor for tensors in GPU memory. Also adds some helpful features when interacting with the GPU.
cunn provides additional modules over the nn library, mainly converting those nn modules to GPU CUDA versions transparently. This makes it easy to switch neural networks to the GPU and vice versa via cuda!
cuDNN is a wrapper of NVIDIA's cuDNN library, which is an optimized library for CUDA containing various fast GPU implementations, such as for convolutional networks and RNN modules.