How can a GNU Fortran / OpenMP program set and retrieve the stacksize-var ICV?
up vote
2
down vote
favorite
I am trying to build a third-party OpenMP program with gfortran / libgomp, but I'm running into trouble with its use of extensions for retrieving and setting the stacksize-var ICV. The source comes with alternatives for Intel Fortran (kmp_get_stacksize()
and kmp_set_stacksize()
) and for the Portland Group compiler (omp_get_stack_size()
and omp_set_stack_size()
), but how can one accomplish the same thing with GNU Fortran and libgomp?
I am aware of the OMP_STACKSIZE
and GOMP_STACKSIZE
environment variables, but it is my understanding that the actual ICV is separate, so that programmatically setting one of these after program startup will not affect the ICV, and that reading one reports only on that environment variable, not on the ICV.
It is acceptable for the solution to be specific to gfortran and / or libgomp running on Linux.
I'm using gfortran and libgomp from GCC 4.8.5.
fortran openmp gfortran
add a comment |
up vote
2
down vote
favorite
I am trying to build a third-party OpenMP program with gfortran / libgomp, but I'm running into trouble with its use of extensions for retrieving and setting the stacksize-var ICV. The source comes with alternatives for Intel Fortran (kmp_get_stacksize()
and kmp_set_stacksize()
) and for the Portland Group compiler (omp_get_stack_size()
and omp_set_stack_size()
), but how can one accomplish the same thing with GNU Fortran and libgomp?
I am aware of the OMP_STACKSIZE
and GOMP_STACKSIZE
environment variables, but it is my understanding that the actual ICV is separate, so that programmatically setting one of these after program startup will not affect the ICV, and that reading one reports only on that environment variable, not on the ICV.
It is acceptable for the solution to be specific to gfortran and / or libgomp running on Linux.
I'm using gfortran and libgomp from GCC 4.8.5.
fortran openmp gfortran
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am trying to build a third-party OpenMP program with gfortran / libgomp, but I'm running into trouble with its use of extensions for retrieving and setting the stacksize-var ICV. The source comes with alternatives for Intel Fortran (kmp_get_stacksize()
and kmp_set_stacksize()
) and for the Portland Group compiler (omp_get_stack_size()
and omp_set_stack_size()
), but how can one accomplish the same thing with GNU Fortran and libgomp?
I am aware of the OMP_STACKSIZE
and GOMP_STACKSIZE
environment variables, but it is my understanding that the actual ICV is separate, so that programmatically setting one of these after program startup will not affect the ICV, and that reading one reports only on that environment variable, not on the ICV.
It is acceptable for the solution to be specific to gfortran and / or libgomp running on Linux.
I'm using gfortran and libgomp from GCC 4.8.5.
fortran openmp gfortran
I am trying to build a third-party OpenMP program with gfortran / libgomp, but I'm running into trouble with its use of extensions for retrieving and setting the stacksize-var ICV. The source comes with alternatives for Intel Fortran (kmp_get_stacksize()
and kmp_set_stacksize()
) and for the Portland Group compiler (omp_get_stack_size()
and omp_set_stack_size()
), but how can one accomplish the same thing with GNU Fortran and libgomp?
I am aware of the OMP_STACKSIZE
and GOMP_STACKSIZE
environment variables, but it is my understanding that the actual ICV is separate, so that programmatically setting one of these after program startup will not affect the ICV, and that reading one reports only on that environment variable, not on the ICV.
It is acceptable for the solution to be specific to gfortran and / or libgomp running on Linux.
I'm using gfortran and libgomp from GCC 4.8.5.
fortran openmp gfortran
fortran openmp gfortran
asked Nov 19 at 16:15
John Bollinger
76.6k63771
76.6k63771
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
The standard itself does not provide a way to modify or retrieve the stacksize-var ICV. So you are doomed to use implementation-specific solutions.
Now libgomp forwards the values specified by environment variables directly to pthread.
So you could say that libgomp stores stacksize-var within gomp_thread_attr
. Unfortunately that seems to be a local symbol in libgomp
and I don't believe you can reasonably access this.
libgomp's initialize_env
is already called during library initialization, not at the first parallel region, so modifying the environment variable is in fact not effective.
For the non-master threads you can at least read the actual value. Although pthread may use an aligned stack size, so it may not be the same value that libgomp specifies.
size_t stacksize;
pthread_attr_t attr;
// TODO check return values
pthread_getattr_np(pthread_self(), &attr);
pthread_attr_getstacksize(&attr, &stacksize);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The standard itself does not provide a way to modify or retrieve the stacksize-var ICV. So you are doomed to use implementation-specific solutions.
Now libgomp forwards the values specified by environment variables directly to pthread.
So you could say that libgomp stores stacksize-var within gomp_thread_attr
. Unfortunately that seems to be a local symbol in libgomp
and I don't believe you can reasonably access this.
libgomp's initialize_env
is already called during library initialization, not at the first parallel region, so modifying the environment variable is in fact not effective.
For the non-master threads you can at least read the actual value. Although pthread may use an aligned stack size, so it may not be the same value that libgomp specifies.
size_t stacksize;
pthread_attr_t attr;
// TODO check return values
pthread_getattr_np(pthread_self(), &attr);
pthread_attr_getstacksize(&attr, &stacksize);
add a comment |
up vote
2
down vote
accepted
The standard itself does not provide a way to modify or retrieve the stacksize-var ICV. So you are doomed to use implementation-specific solutions.
Now libgomp forwards the values specified by environment variables directly to pthread.
So you could say that libgomp stores stacksize-var within gomp_thread_attr
. Unfortunately that seems to be a local symbol in libgomp
and I don't believe you can reasonably access this.
libgomp's initialize_env
is already called during library initialization, not at the first parallel region, so modifying the environment variable is in fact not effective.
For the non-master threads you can at least read the actual value. Although pthread may use an aligned stack size, so it may not be the same value that libgomp specifies.
size_t stacksize;
pthread_attr_t attr;
// TODO check return values
pthread_getattr_np(pthread_self(), &attr);
pthread_attr_getstacksize(&attr, &stacksize);
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The standard itself does not provide a way to modify or retrieve the stacksize-var ICV. So you are doomed to use implementation-specific solutions.
Now libgomp forwards the values specified by environment variables directly to pthread.
So you could say that libgomp stores stacksize-var within gomp_thread_attr
. Unfortunately that seems to be a local symbol in libgomp
and I don't believe you can reasonably access this.
libgomp's initialize_env
is already called during library initialization, not at the first parallel region, so modifying the environment variable is in fact not effective.
For the non-master threads you can at least read the actual value. Although pthread may use an aligned stack size, so it may not be the same value that libgomp specifies.
size_t stacksize;
pthread_attr_t attr;
// TODO check return values
pthread_getattr_np(pthread_self(), &attr);
pthread_attr_getstacksize(&attr, &stacksize);
The standard itself does not provide a way to modify or retrieve the stacksize-var ICV. So you are doomed to use implementation-specific solutions.
Now libgomp forwards the values specified by environment variables directly to pthread.
So you could say that libgomp stores stacksize-var within gomp_thread_attr
. Unfortunately that seems to be a local symbol in libgomp
and I don't believe you can reasonably access this.
libgomp's initialize_env
is already called during library initialization, not at the first parallel region, so modifying the environment variable is in fact not effective.
For the non-master threads you can at least read the actual value. Although pthread may use an aligned stack size, so it may not be the same value that libgomp specifies.
size_t stacksize;
pthread_attr_t attr;
// TODO check return values
pthread_getattr_np(pthread_self(), &attr);
pthread_attr_getstacksize(&attr, &stacksize);
edited Nov 19 at 18:24
answered Nov 19 at 18:19
Zulan
15k62868
15k62868
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378713%2fhow-can-a-gnu-fortran-openmp-program-set-and-retrieve-the-stacksize-var-icv%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown