compile EnergyPlus and Radiance for AVX
Is there a way to compile EnergyPlus and Radiance with options to take advantage of AVX?
First time here? Check out the Help page!
Is there a way to compile EnergyPlus and Radiance with options to take advantage of AVX?
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.
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.
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.
@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.
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)!
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.
@__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?
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2017-10-21 17:34:50 -0600
Seen: 200 times
Last updated: Oct 22 '17