https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63700

            Bug ID: 63700
           Summary: Is is impossible to set the OpenMP stack size from
                    inside a program
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: walter.zimmer at dlr dot de
                CC: jakub at gcc dot gnu.org

We have a binary which uses a lot of stack due to external libray we have no
control over. Single threaded, this is no problem, setrlimit() works fine. But
for OpenMP, setting OMP_STACKSIZE seems to be the only option so set the stack
size for OpenMP threads.

Unfortunately, it can't be set from within the program, as the libgomp code is
always executed before the main program code. We also tried __attribute__
((constructor)) and section(".init"), but for shared links, the libgomp code is
always called before we can set rlimit or OMP_STACKSIZE (nice to see with
OMP_DISPLAY_ENV).

We really want to avoid having external dependencies, so we try to avoid having
to set external environment variables.

Having a small routine which sets the OpenMP internal stack size before the
first threads are created would solve this problem. Such a routine is not
specified in the standard, but it might be implemented as a gomp routine to
account for that.

Or did I miss something? Is this behaviour maybe intentional? What would be the
best solution to set the OpenMP stack size inside a program?

Reply via email to