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:
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
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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() |
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