Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable Length Arrays and MSVC support #446

Open
GiudGiud opened this issue Oct 25, 2019 · 0 comments
Open

Variable Length Arrays and MSVC support #446

GiudGiud opened this issue Oct 25, 2019 · 0 comments

Comments

@GiudGiud
Copy link
Contributor

GiudGiud commented Oct 25, 2019

For optimization purposes, variable length arrays (VLAs) have been introduced in the main attenuation / tally routines as buffers to store scalar fluxes before transferring them to the main scalar flux(es for linear source) arrays.

This made the code significantly faster, possibly because those arrays live on the stack of each thread, rather than on the heap. By being careful about false sharing, I think similar performance may be achieved with regular buffers allocated before the transport sweep on the heap.

This change may be desirable, because VLAs are not part of the C++ standard, but were added to C99 and are offered as a C++ extension by GCC and ICPC. However, not by MSVC so OpenMOC will not compile with that.

If there is a need, I could easily add an installation option to offer a strictly C++ compliant version that will compile everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant