Encapsulate logic in DistributedType
🚀 Feature
Any logic to compare different DistributedTypes should be encapsulated by the enum itself.
Motivation

 #5743 (comment)
 #5743 (comment)
 #5970 (comment)

Additional context

  
    
      pytorch-lightning/pytorch_lightning/utilities/enums.py
    
    
        Lines 51 to 69
      in
      0b27147
    
  
  
    

        
          
           class DistributedType(LightningEnum): 
        

        
          
               """ Define type of ditributed computing. 
        

        
          
            
        

        
          
               >>> # you can math the type with string 
        

        
          
               >>> DistributedType.DDP == 'ddp' 
        

        
          
               True 
        

        
          
               >>> # which is case invariant 
        

        
          
               >>> DistributedType.DDP2 in ('ddp2', ) 
        

        
          
               True 
        

        
          
               """ 
        

        
          
               DP = 'dp' 
        

        
          
               DDP = 'ddp' 
        

        
          
               DDP2 = 'ddp2' 
        

        
          
               DDP_SPAWN = 'ddp_spawn' 
        

        
          
               DEEPSPEED = 'deepspeed' 
        

        
          
               HOROVOD = 'horovod' 
        

        
          
               DDP_SHARDED = 'ddp_sharded' 
        

        
          
               DDP_SHARDED_SPAWN = 'ddp_sharded_spawn' 
        

        
          
               RPC_SEQUENTIAL_PLUGIN = 'rpc_sequential' 
        
    
  


cc: @awaelchli