Skip to content

Variable Length Arrays and MSVC support #446

@GiudGiud

Description

@GiudGiud

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions