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

Add --heap-size-hint parameter #547

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/juliacall.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ be configured in two ways:
| `-X juliacall-threads=<N\|auto>` | `PYTHON_JULIACALL_THREADS=<N\|auto>` | Launch N threads. |
| `-X juliacall-warn-overwrite=<yes\|no>` | `PYTHON_JULIACALL_WARN_OVERWRITE=<yes\|no>` | Enable or disable method overwrite warnings. |
| `-X juliacall-autoload-ipython-extension=<yes\|no>` | `PYTHON_JULIACALL_AUTOLOAD_IPYTHON_EXTENSION=<yes\|no>` | Enable or disable IPython extension autoloading. |
| `-X juliacall-heap-size-hint=<N>` | `PYTHON_JULIACALL_HEAP_SIZE_HINT=<N>` | Hint for initial heap size in bytes. |

## [Multi-threading](@id py-multi-threading)

Expand Down
3 changes: 3 additions & 0 deletions docs/src/releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## 0.9.24
* Added `PYTHON_JULIACALL_HEAP_SIZE_HINT` option to configure initial Julia heap size.

## 0.9.23 (2024-08-22)
* Bug fixes.

Expand Down
9 changes: 5 additions & 4 deletions pysrc/juliacall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def int_option(name, *, accept_auto=False, **kw):
except ValueError:
raise ValueError(f'{s}: expecting an int'+(' or auto' if accept_auto else ""))

def args_from_config():
argv = [CONFIG['exepath']]
for opt, val in CONFIG.items():
def args_from_config(config):
argv = [config['exepath']]
for opt, val in config.items():
MilesCranmer marked this conversation as resolved.
Show resolved Hide resolved
if opt.startswith('opt_'):
if val is None:
if opt == 'opt_handle_signals':
Expand Down Expand Up @@ -146,6 +146,7 @@ def args_from_config():
CONFIG['opt_warn_overwrite'] = choice('warn_overwrite', ['yes', 'no'])[0]
CONFIG['opt_handle_signals'] = choice('handle_signals', ['yes', 'no'])[0]
CONFIG['opt_startup_file'] = choice('startup_file', ['yes', 'no'])[0]
CONFIG['opt_heap_size_hint'] = option('heap_size_hint')[0]

# Stop if we already initialised
if CONFIG['inited']:
Expand Down Expand Up @@ -181,7 +182,7 @@ def args_from_config():
CONFIG['lib'] = lib = c.PyDLL(libpath, mode=c.RTLD_GLOBAL)

# parse options
argc, argv = args_from_config()
argc, argv = args_from_config(CONFIG)
jl_parse_opts = lib.jl_parse_opts
jl_parse_opts.argtypes = [c.c_void_p, c.c_void_p]
jl_parse_opts.restype = None
Expand Down
Loading