Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Simultaneously run a number of independent EnergyPlus simulations on multiple cores on Linux via a script.

asked 2019-05-02 13:21:28 -0500

Julian's avatar

updated 2019-06-12 09:34:37 -0500

Dear all,

I would like to run simultaneously a number of independent energyplus simulations on multiple cores on Linux.

There are several sources of information that explain how to do this (1-3 below)

Ref (1) explains that the energyplus executable, a number of files and windows libraries are copied in the directory where energyplus is to be executed using default idf and weather files (in.idf, in.epw).

Ref (2), for example @__AmirRoth__'s reply suggest the following script in order to run multiple energyplus simulations:

for i in glob('*.idf'):
   for w in glob('*.epw'):["EnergyPlus -p %s -w %s %s" % (i[:-len('.idf')] + '_' + w[:-len('.epw')], w, i)])

My understanding is that the spawns a new process, which should run independently and in parallel of the previosly spawned similar processes.

Since this solution appears be exactly what I need, but at the same time does not explicitly copy the files and libraries requested in (1), a doubt arises:

  • can we execute parallel and independent energyplus simulations in this way (without copying any libraries and files as in (1)) under Linux?

  • if it is possible, any experiences shared would be greatly appreciated;

  • if not possible, what would be the required files and libraries to be copied under Linux and again, any experiences shared would be greatly appreciated

Thank you.

(1) "Run EnergyPlus in Parallel" on BigLadder or energyplus documentaion:

(2) "Script for multiple simulations" post on this forum:

(3) "How to run EnergyPlus in multi-core cluster(Linux)?" post on this forum

P.S. I have asked a more concise question with similar content below Amir Roth's comment in (1), but thought that a separate discussion might be a better idea.

edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted

answered 2019-05-03 18:39:58 -0500

santoshphilip's avatar

eppy will be able to run energyplus on multiple cores. It is not well documented in the user documentation - see

You may be able to figure it out from the code and the unit tests

We would be mighty obliged if you can help improve the documentation.

edit flag offensive delete link more

answered 2019-05-02 13:37:49 -0500

One option is to use the parallel gen in ruby. Example:

# gem for running jobs in parallel
require 'parallel'
num_parallel = 4
Parallel.each(jobs, in_threads: num_parallel) do |job|
  puts job
edit flag offensive delete link more



Hi Matthew,

Thank you for taking the time to think about this and to promptly write your answer. I see your point and perhaps understand your script.

My concern is if multiple and independent energyplus runs can be run in Linux via a script as parallel processes (not via Open Studio or Launcher - I have just edited the title of my post adding "script") without copying in the energyplus executable, the idd file and libraries as described in refference (1) from my post.

Are you aware if this is possible?

Thank you.

Julian's avatar Julian  ( 2019-05-02 15:09:03 -0500 )edit

answered 2019-06-14 02:50:31 -0500

Jon Morgan's avatar

My current approach is to use a python script to create a batch file that includes all the simulations, one per line. And to then pass the batch file to the 'parallel' command in linux to run the batch file. I can provide additional information if you think this would be a useful approach for you, but in the meantime here is a basic outline.

'parallel' man page:

example usage (to run 6 jobs simultaneously): parallel -j 6 --progress --no-notice <

and the file would contain something like this: energyplus --weather /path_to_wth_files/AUS_VIC.Melbourne.948680_RMY.epw --output-prefix result --output-suffix C file1.idf energyplus --weather /path_to_wth_files/AUS_VIC.Melbourne.948680_RMY.epw --output-prefix result --output-suffix C file2.idf energyplus --weather /path_to_wth_files/AUS_VIC.Melbourne.948680_RMY.epw --output-prefix result --output-suffix C file3.idf

You might need to play around with this idea a little bit because my batch file doesn't look quite like that. Each line of my batch file is a call to another python script that creates a temporary directory and runs energyplus in that directory. If you go down this route (i.e. with temp directories) then you will likely hit some of the same issues I did (such as needing an Energy+.ini file in the temp directory).

Sorry that this is only a partial answer but hopefully of some use.

And lastly, I'm running on a fairly old 8-core intel machine and for my system there isn't much benefit in running more than 5-way parallel.

edit flag offensive delete link more


Hi Jon, Thank you for taking the time to share your experience. It is all very useful information - starting with the way you organize your batch file, the "parallel" command and the fact that for you too on an intel processor it does not make sense to run more than 5 concurrent simulations. Except small details this all coincides with the way I have organised the parallel execution. The only thing that differs from my experience is that I did not need to copy the Energy+.ini. This leaves a doubt that I might not have done it correctly. May I kindly ask you to share your observations? Thankyo

Julian's avatar Julian  ( 2019-06-14 14:53:24 -0500 )edit

answered 2019-06-13 17:01:20 -0500

Julian's avatar

Hi SantoshPhilip, Liq2519,

Thank you for your suggestions.

Looking into eppy ( it looks like that new processes are spawn much like in the simple shell script at the end of this post.

The machine I am running this script on is an Intel, 8 core, 32 GB Ram, running Ubuntu. I do not copy any libraries in the current directories contrary to the suggestion in (1) from my original post.

My results show that: - for a small model (6 zones) compute time for running 1,2,3, ... 8 processes in parallel is the same as the compute time for running 1 process, which means that the processes run concurrently without impeding each other's performance - for a bigger model however (150 zones), the time for a single process = time for 2 parallel processes, but for a higher number of concurrent processes, the compute time of each individual process increases to such an extent that running more than 5-6 concurrent processes does not bring any speedup

This could perhaps mean that there might be a bottleneck (when running energyplus) somewhere between RAM and cache for this particular Intel chip.

It looks like then that we can run energyplus as parallel and independent processes under Linux, without copying any libraries, but currently the degree of independence is machine dependent.

Any thoughts/suggestions are welcome.

Kind regards, Julian

P.S. On the other hand, I noticed also that readvars does not work well in this parallel processes set up.

startTime=$(date +%s)
run1/ > ./run1/run.log & 
run2/ > ./run2/run.log &
run8/ > ./run8/run.log &
echo $pidRun1, $pidRun2, ... , $pidRun8 completed
endTime=$(date +%s)
durationInSeconds=$(( $endTime - $startTime ))
echo "It took $durationInSeconds seconds"

enter code here

Where, is similar to:

energyplus -d run1 -w weather.epw model.idf

edit flag offensive delete link more

answered 2019-06-12 08:54:38 -0500

liq2519's avatar

You can use Python module multiprocessing and modify the codes in Ref (2) to run on multiple cores.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer


Question Tools



Asked: 2019-05-02 13:21:28 -0500

Seen: 1,418 times

Last updated: Jun 14 '19