First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
Python also has the ability to split work across multiple cores. Some sample code below on how we run multiple dynamic simulations on the same machine in parallel. Be careful on how many workers you add. The problem can become I/O with all the data from the multiple runs and running 4 in parallel will not be 400% faster than running 1. You get a diminishing rate of return the more cores you add. With this code, you can easily play around with how many cores you want to use and find the optimal number for your machine.
Sample code:
import multiprocessing from multiprocessing import Process from multiprocessing import Pool
workers = multiprocessing.cpu_count() - 1 # Run on N-1 cores on local machine
p = Pool(workers)
p.map(run_test, tests) #
2 | No.2 Revision |
Python also has the ability to split work across multiple cores. Some sample code below on how we run multiple dynamic simulations on the same machine in parallel. Be careful on how many workers you add. The problem can become I/O with all the data from the multiple runs and running 4 in parallel will not be 400% faster than running 1. You get a diminishing rate of return the more cores you add. With this code, you can easily play around with how many cores you want to use and find the optimal number for your machine.
Sample code:
import multiprocessing
from multiprocessing import Process
from multiprocessing import