you can think of rank as an ID of a process controlling one (preferred) or multiple GPUs.
local rank is a local ID of such process.
if you have 1 node with 4GPUs we prefer that you use DDP with 4 ranks (processes)