Minimal Example for Python Multiprocessing
November 18, 2024•56 words
The following is a minimal example for multiprocessing in Python. A very useful guide written by Jan Bodnar is here.
from multiprocessing import Process
def fun(i):
return i
def main():
proc = []
for i in 1:100:
p = Process(target=fun, args=(i, ))
p.start()
proc.append(p)
for p in proc:
p.join()
if __name__ == '__main__':
main()
...
Read post