class_docstr: A hash that generates group key and instance key for AllReduce.
docstr: Generate or retrieve the group key based on a list of strings of the participating devices.
docstr_tok: ["Generate","or","retrieve","the","group","key","based","on","a","list","of","strings","of","the","participating","devices","."]
code: def get_group_key(self, canonical_devices):
      """Generate or retrieve the group key based on a list of strings of the participating devices."""
      for d in canonical_devices:
          if not isinstance(d, str):
              raise ValueError("Need canonicalized devices")
      key_id = ",".join(canonical_devices)
      if key_id not in self._group_key_dict:
          new_key = self._group_key
          self._group_key += 1
          self._group_key_dict[key_id] = new_key
      return self._group_key_dict[key_id]
  
file_path: autodist/autodist/kernel/synchronization/collective_key.py
imports: import threading
  import hashlib
  from autodist.const import MAX_INT32
label_desc: Use image node_id 2 for calling the CollectiveKey obj's underlying member method code with example usage: obj.get_group_key(canonical_devices) and returns: self