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

Perfomance: Removing age looping / order of stock dimensions #134

Open
lentinj opened this issue Dec 21, 2023 · 0 comments
Open

Perfomance: Removing age looping / order of stock dimensions #134

lentinj opened this issue Dec 21, 2023 · 0 comments

Comments

@lentinj
Copy link
Collaborator

lentinj commented Dec 21, 2023

@bthe mentioned that a model without age optimises significantly faster. In general removing the age loops when not required is hard, but there's a bunch of housekeeping in predation that could do stock_ssinv(stock__predby_predstock, 'area') instead of stock_ss(stock__predby_predstock), and remove the need for looping over each age this way.

However, TMB say no:-

Error in convert_subset(tail(in_call, -2)) :
  Missing values must be at start of subset, can't restructure array: fish__predby_comm[, fish__area_idx, ]
Calls: g3_to_tmb ... cpp_code -> paste0 -> cpp_code -> paste0 -> convert_subset

Age being on the end means that bumping everything up one is a much easier operation, but maybe it's a poor choice in retrospect? There's always going to be more age dimensions than area.

lentinj added a commit that referenced this issue May 7, 2024
substitute "default" / "missing" into subset expressions, so you can
specify "default + 1" as well as "default".

Add "vec" parameter so you can subset all dimensions up to a given one,
as well as all/nothing.
lentinj added a commit that referenced this issue May 7, 2024
stock_ss() now has enough flexibility to replace action_age's custom
shenanigans, so rewrite with stock_ss()

Use "vec = age", rather than "vec = all", so we no longer have to have
age dimensions at the start.
lentinj added a commit that referenced this issue May 7, 2024
Without an age dimension, the stock_ss() calls will fail, but it's not
a sensible thing to do in the first place.

Fail with an informative error message.
lentinj added a commit that referenced this issue May 7, 2024
Without an age dimension, the stock_ss() calls will fail, but it's not
a sensible thing to do in the first place.

Fail with an informative error message.
@lentinj lentinj mentioned this issue May 10, 2024
6 tasks
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

No branches or pull requests

1 participant