P are intended for general-purpose GPU compute applications (and have 1, 8 or 16 GPUs, more RAM and fewer CPUs). Typically you might use these for scientific computing / machine learning / anything CUDA intensive.
G are optimized for graphics-intensive applications (and have 1, 2 or 4 GPUs, less RAM and more CPUs) - you might use these for design work, gaming etc.