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

Output desired size when AD container size is exceeded #84

Open
GiudGiud opened this issue Sep 26, 2022 · 6 comments
Open

Output desired size when AD container size is exceeded #84

GiudGiud opened this issue Sep 26, 2022 · 6 comments

Comments

@GiudGiud
Copy link

It would be convenient to tell users which size to resize to

This is coming up here
idaholab/moose#22191 (reply in thread)

@GiudGiud
Copy link
Author

does metaphysicl allow verbose error messages?

@roystgnr
Copy link
Owner

We don't have a macro for it, but we ought to add one.

@roystgnr
Copy link
Owner

I'm not sure it's going to be possible to tell users which size to resize to. We hit that error and exit the first time we try to resize to anything larger than the current size, so we won't keep going to find out what the final required size is going to be. Add an ADReal with (dense, to simplify the example) gradient indices of [0,20) to a vector with indices of [15,35) and if your max sparse vector size is 30 the program is going to bail there and tell you needed 35, not wait around to find out that your code was later going to add a third vector with indices of [30,50) and a fourth with [45,65).

I almost said "can't" rather than "won't" keep going, because I'm wondering if there's anything we can do here to actually keep going until we're done.

Looking at DualReal.h, for one thing we really ought to have a DynamicSparseNumberArray option, not just SemiDynamicSparseNumberArray and NumberArray. "There is always some sparsity size which will make your program scream and die" is a design choice there for efficiency, not a MetaPhysicL-imposed requirement. And, that said... perhaps we could add a compile-time option to DSNA that updates a global maximum_sparsity_size with every resize? The additional potential performance issues (We'd need to do it atomically! Atomic max/min aren't in C++20; we'd need a loop!) make me cringe, but from a user interface perspective it would be nice to be able to say "recompile this way and run, then at the end of the program you'll see exactly how you'd need to recompile a different way to get your speedup back for this particular problem".

@lindsayad
Copy link
Collaborator

Especially given the recent timings in libMesh#29 I think it definitely makes sense to have DynamicSparseNumberArray be a configuration option for MOOSE. Perhaps it should even be the default depending on the application

@GiudGiud
Copy link
Author

GiudGiud commented Sep 27, 2022

it could be part of our MOOSE makefile. When you include a module that needs a high number, we ask you to reconfigure?

@lindsayad
Copy link
Collaborator

Maybe but that is a pain for folks not using the AD portions of applications

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

3 participants