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

improve ULT stack size configuration #340

Merged
merged 3 commits into from
Jun 29, 2021

Conversation

shintaro-iwasaki
Copy link
Collaborator

@shintaro-iwasaki shintaro-iwasaki commented Jun 29, 2021

Pull Request Description

ULT stack overflow causes numerous issues (see #274, #324, #333, and this thread). This PR adds new features to ease stack size configuration.

1. Configure-time stack size setting

The user can configure a default ULT stack size.

./configure --enable-default-stacksize=102400

This setting can be overwritten by ABT_THREAD_STACKSIZE

# The default ULT stack size is that of configure-time (e.g., 102400)
./a.out
# The default ULT stack size is 204800 
ABT_THREAD_STACKSIZE=204800 ./a.out

2. Run-time stack size check

If --enable-ver20-api is set, the application can now obtain the default stack size via ABT_info_query_config() without initializing Argobots (i.e., before ABT_init()).

// Argobots configured with --enable-ver20-api
size_t stacksize;
ABT_info_query_config(ABT_INFO_QUERY_KIND_DEFAULT_THREAD_STACKSIZE, (void *)&stacksize);
assert(stacksize >= 65536);

Note that by default (without --enable-ver20-api), ABT_info_query_config() needs Argobots initialization to maintain the backward compatibility of API.

// Default Argobots configuration
ABT_init(0, 0);
size_t stacksize;
// If ABT_info_query_config() is called without initializing Argobots, an error is returned.
ABT_info_query_config(ABT_INFO_QUERY_KIND_DEFAULT_THREAD_STACKSIZE, (void *)&stacksize);
assert(stacksize >= 65536);
ABT_finalize();

This PR does not change the default ULT stack size (16KB).

Checklist

  • Reference appropriate issues (with "Fixes" or "See" as appropriate)
  • Commits are self-contained and do not do two things at once
  • Commit message is of the form: module: short description and follows good practice
  • Passes whitespace checkers

--enable-default-stacksize=XXX can set the default ULT stack size.  This
setting is overwritten by ABT_THREAD_STACKSIZE=XXX.
This patch updates ABT_info_query_config() so that the user can get more
information without initializing the Argobots runtime.  This is useful
especially when an application wants to examine the underlying Argobots
configuration before ABT_init().

Note that the user needs to enable an experimental Argobots 2.0 API
(--enable-ver20-api) since the 1.x specification defines that
ABT_info_query_config() should return an error when Argobots is not
initialized.
@shintaro-iwasaki
Copy link
Collaborator Author

test:argobots/all

@shintaro-iwasaki
Copy link
Collaborator Author

test:argobots/all

@shintaro-iwasaki shintaro-iwasaki merged commit 1109fa0 into pmodels:main Jun 29, 2021
@shintaro-iwasaki shintaro-iwasaki deleted the pr/stacksize_config branch July 29, 2021 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants