aadnk commited on
Commit
479b187
1 Parent(s): 596fd47

Always create N processes for N devices even with small files

Browse files

That way, we avoid accidentally allocating the same model twice
on the same device.

Files changed (1) hide show
  1. src/vadParallel.py +4 -5
src/vadParallel.py CHANGED
@@ -104,13 +104,12 @@ class ParallelTranscription(AbstractTranscription):
104
  parameters = []
105
  segment_index = config.initial_segment_index
106
 
107
- for i in range(len(merged_split)):
108
- device_segment_list = list(merged_split[i])
 
 
109
  device_id = gpu_devices[i]
110
 
111
- if (len(device_segment_list) <= 0):
112
- continue
113
-
114
  print("Device " + str(device_id) + " (index " + str(i) + ") has " + str(len(device_segment_list)) + " segments")
115
 
116
  # Create a new config with the given device ID
 
104
  parameters = []
105
  segment_index = config.initial_segment_index
106
 
107
+ for i in range(len(gpu_devices)):
108
+ # Note that device_segment_list can be empty. But we will still create a process for it,
109
+ # as otherwise we run the risk of assigning the same device to multiple processes.
110
+ device_segment_list = list(merged_split[i]) if i < len(merged_split) else []
111
  device_id = gpu_devices[i]
112
 
 
 
 
113
  print("Device " + str(device_id) + " (index " + str(i) + ") has " + str(len(device_segment_list)) + " segments")
114
 
115
  # Create a new config with the given device ID