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

compile EnergyPlus and Radiance for AVX

asked 2017-10-21 17:34:50 -0600

Determinant's avatar

updated 2017-10-22 08:49:53 -0600

Is there a way to compile EnergyPlus and Radiance with options to take advantage of AVX?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-10-22 13:34:04 -0600

updated 2017-10-22 13:36:13 -0600

See my comment in this question. Basically you need to use -march=corei7-avx (-march=sandybridge in GCC4.9+), -march=core-avx2 (-march=haswell in GCC4.9+), or -march=native. The latter option will compile to the highest available option on your computer and generate assembly code specific to the processor on your machine. See this link for all available options on GCC/Clang. For windows, you need to specify the /arch flag for AVX and AVX2. With these options set, the compiler will attempt to use AVX(2) where appropriate.

Now like Amir mentioned, while the compiler will attempt to use AVX(2), the benefit may be marginal in the case of EnergyPlus. The way EnergyPlus code is currently structured makes it difficult for the compiler to automatically and fully use newer instructions and bigger SIMD pipelines. This may change in the future as optimized linear algebra libraries are used in EnergyPlus and code is refactored.

edit flag offensive delete link more


Nice, Mark. Thanks for those compile options. In the past, super-fine-tuning the compile options for Radiance yielded trivial benefits (see Mark Stock's benchmark page for details). But given the right hardware, maybe someone can give AVX a go with your suggestions here.

rpg777's avatar rpg777  ( 2017-10-23 11:00:02 -0600 )edit

It does look detailed. I'm marking as accepted answer because I believe this to be the correct answer but haven't done it yet. FYI I've done the following already to speed up OpenStudio's Radiance measure: Switched from Windows to Linux (now multithreads on i7), SSD drive, more RAM and better cooling on CPU. It's cut down set of 42 OS Radiance PAT runs from 13:45 hrs:mins to 5:15. Well worth all of it. Next step is AVX...and might even DIY a water source cooler.

Determinant's avatar Determinant  ( 2017-10-23 18:32:46 -0600 )edit

@Julien Marrec @MarkAdams, @rpg777, @__AmirRoth__ FYI I posted a request for AVX integration on the E+ request site. Upvote at the site if you like.

Determinant's avatar Determinant  ( 2017-10-23 20:36:26 -0600 )edit

OK well running Radiance multithreaded is obviously gonna make a tremendous difference. Kudos for running Radiance on a proper OS to take advantage of that. I seriously doubt you'll find anything like that kind of speed improvement fussing about with AVX, but if you do, please post your findings here (and on Mark's benchmark page)!

rpg777's avatar rpg777  ( 2017-10-24 09:57:09 -0600 )edit

answered 2017-10-22 08:54:08 -0600

EnergyPlus doesn't use standard linear algebra libraries yet and (most of) its arrays are "hidden" within classes that use hand-rolled arithmetic to simulate FORTRAN style access. It's going to be difficult for a compiler to analyze all of that to automatically leverage AVX. :(

Since Radiance was "born" as a C program, the situation there may be different.

edit flag offensive delete link more


@__AmirRoth__ have you seen the Eigen template library for arrays, etc.? It's already being used by the Kiva object in EnergyPlus. Would this simplify mod'ing the E+ code to take advantage of AVX?

Determinant's avatar Determinant  ( 2017-11-01 22:50:08 -0600 )edit

Your Answer

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

Add Answer


Question Tools

1 follower


Asked: 2017-10-21 17:34:50 -0600

Seen: 182 times

Last updated: Oct 22 '17