class_docstr: The abstract dist sparse optimizer.
  
  Note: dgl dist sparse optimizer only work with dgl.distributed.DistEmbedding
  
  Parameters
  ----------
  params : list of DistEmbedding
      The list of DistEmbedding.
  lr : float
      The learning rate.
docstr: Save the local state_dict to disk on per rank.
  
  Saved dict contains 2 parts:
  
  * 'params': hyper parameters of the optimizer.
  * 'emb_states': partial optimizer states, each embedding contains 2 items:
      1. ```ids```: global id of the nodes/edges stored in this rank.
      2. ```states```: state data corrseponding to ```ids```.
  
  NOTE: This needs to be called on all ranks.
  
  Parameters
  ----------
  f : Union[str, os.PathLike]
      The path of the file to save to.
  
  See Also
  --------
  load
docstr_tok: ["Save","the","local","state_dict","to","disk","on","per","rank",".","Saved","dict","contains","2","parts",":","*","'params","'",":","hyper","parameters","of","the","optimizer",".","*","'emb_states","'",":","partial","optimizer","states",",","each","embedding","contains","2","items",":","1",".","``","`","ids","``","`",":","global","id","of","the","nodes\/edges","stored","in","this","rank",".","2",".","``","`","states","``","`",":","state","data","corrseponding","to","``","`","ids","``","`",".","NOTE",":","This","needs","to","be","called","on","all","ranks",".","Parameters","--","--","--","--","--","f",":","Union","[","str",",","os.PathLike","]","The","path","of","the","file","to","save","to",".","See","Also","--","--","--","--","load"]
code: def save(self, f):
      """Save the local state_dict to disk on per rank.
  
      Saved dict contains 2 parts:
  
      * 'params': hyper parameters of the optimizer.
      * 'emb_states': partial optimizer states, each embedding contains 2 items:
          1. ```ids```: global id of the nodes/edges stored in this rank.
          2. ```states```: state data corrseponding to ```ids```.
  
      NOTE: This needs to be called on all ranks.
  
      Parameters
      ----------
      f : Union[str, os.PathLike]
          The path of the file to save to.
  
      See Also
      --------
      load
      """
      if self._world_size > 1:
          th.distributed.barrier()
      f = f if isinstance(f, str) else str(f, "UTF-8")
      f = f"{f}_{self._rank}"
      th.save(self.local_state_dict(), f)
      if self._world_size > 1:
          th.distributed.barrier()
  
imports: import abc
  import warnings
  from abc import abstractmethod
  from os.path import exists
  import torch
  import dgl
  from ....None import backend
  from ...dist_tensor import DistTensor
  from ...graph_partition_book import EDGE_PART_POLICY, NODE_PART_POLICY
  from ...nn.pytorch import DistEmbedding
  from .utils import alltoall, alltoallv
label_desc: Use image node_id 4 for calling the DistSparseGradOptimizer obj's underlying member method code with example usage: obj.save(f) without return types