Oct-17-2020, 12:54 PM
Hello,
I'm working on a program to interpolate video frames taking advantage of multithreading or multiprocessing to better take advantage of the idle cpu and gpu times i saw while monitoring.
The function i want to run in parallel or at least with multithreading looks like this at the moment:
But i don't think this will work because the both threads will update the same values and everything will get out of place. That's why i thought that using multiprocessing would be better? But it seems that using the debugger for multiprocessing is not possible?
any help?
thanks
I'm working on a program to interpolate video frames taking advantage of multithreading or multiprocessing to better take advantage of the idle cpu and gpu times i saw while monitoring.
The function i want to run in parallel or at least with multithreading looks like this at the moment:
def interpolate(thread_id): total_sections = 100 section_index = 0 if thread_id == 1: section_index += 1 start_frame = 1 final_frame = 24 while section_index < total_sections: while start_frame < final_frame: #do the interpolation here start_frame += 1 section_index += 2 id = 0 interpolateT0 = multithreading.Thread(target=interpolate, args=(id,)) id = 1 interpolateT1 = multithreading.Thread(target=interpolate, args=(id,)) interpolateT0.start() time.sleep(4) interpolateT1.start()The point is that thread 1 starts with a offset of 1 for the section index, and also +2 is added instead of +1 to the section index so that essentialy thread 0 does sections with pair index number and thread 1 does those with odd numbers.
But i don't think this will work because the both threads will update the same values and everything will get out of place. That's why i thought that using multiprocessing would be better? But it seems that using the debugger for multiprocessing is not possible?
any help?
thanks