Skip to content

Conversation

@mdpiper
Copy link
Member

@mdpiper mdpiper commented Sep 16, 2021

To allow multiple instances of a model to be instantiated (think @wk1984's implementation of GIPL as a use case), the babelizer Fortran interoperability layer has a parameter

integer, parameter :: N_MODELS = 2048

For models that use statically allocated variables, this presents a problem--2048 copies of a model with memory already allocated are created! This, I believe, is at the heart of the problem in csdms/help-desk#104.

In this PR, an undocumented max_instances parameter is added to the build section of the babelizer input file. It's set to a small default number (currently 8), which allows enough instances to be created to run the bmi-tester. Users can override this default value in the babelizer input file; e.g.:

[build]
undef_macros = []
define_macros = []
libraries = []
library_dirs = []
include_dirs = []
extra_compile_args = []
max_instances = 32

or

[build]
undef_macros = []
define_macros = []
libraries = []
library_dirs = []
include_dirs = []
extra_compile_args = []
max_instances = 1

I'm choosing to keep this new parameter undocumented, pending further study.

@mdpiper mdpiper requested a review from mcflugen September 16, 2021 22:10
@mdpiper
Copy link
Member Author

mdpiper commented Sep 16, 2021

@lzhu5 This is the change I'm plotting for the babelizer.

@mdpiper
Copy link
Member Author

mdpiper commented Oct 19, 2021

I should parameterize the tests like @mcflugen did in #60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants