manodeep / Corrfunc

⚡️⚡️⚡️Blazing fast correlation functions on the CPU.
https://corrfunc.readthedocs.io
MIT License
164 stars 50 forks source link

Allow bin refine factors to be passed at runtime #90

Closed manodeep closed 7 years ago

manodeep commented 7 years ago

Runtimes can be significantly affected (particularly, for "unusual" rmax -- either too large or too small a fraction of domain size of the particle distribution). Thus, letting the user configure the bin refine factors at runtime would be a nice addition.

There should be three int8_t (xyz)bin_refine_factor fields added to struct config_options allowing the user to set it up once. Similarly, the maximum number of cells per dimension, max_ncells_per_dim (currently set to 100 via the macro NLATMAX), should also be user configurable. gridlink_* functions already accept the max. cells per dimension, so the max. cells simply needs to be set from the corresponding fields in struct config_options in the implementation routines.

Unless an error occurs; user-configured bin_refine_factor's should always be honored (checked via another bit-flag, bin_refine_scheme, set to enum's BIN_DFL and BIN_CUSTOM for default and custom bin refine factors).

Resolving this issue will require 3 int8_t (xyz)bin_refine_factor for the bin refine factors in the 3 dimensions, 1 int8_t bin_refine_scheme for the bit-flag showing custom bin refine factors, and 1 int16_t max_ncells_per_dim for the equivalent of NLATMAX. Must be accompanied with two helper routines, one for setting custom bin refine factors, and one for resetting (the reset function should simply change bin_refine_scheme to BIN_DFL and the implementation routines should then proceed with the default bin refine factors).

manodeep commented 7 years ago

Fixed by commit range https://github.com/manodeep/Corrfunc/commit/8451c069d4d4bac168e07d5e78b122b607caf35e -- https://github.com/manodeep/Corrfunc/commit/9b1921d75241bd3dbacdf24e5e91f189e0706d9c