-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
WIP: Adding config to nx-parallel #68
WIP: Adding config to nx-parallel #68
Conversation
For proper integration, I will need to change a few lines of code in all the algorithms. So far, I've modified Thank you :) |
After reading the blog about adding config I am more in favor of avoiding the use of the networkx config system for controlling the nx-parallel use of joblib. Said another way, I think it would be better to keep the user in the joblib config system and support no joblib related parameters in Duplicating the joblib parameters doesn't make sense to me. And maintaining two (or creating a third) config system seems to ask for confusion and duplication. Can we just rely on users using the joblib config system? |
nx-parallel is a networkx backend that uses joblib(right now), not a joblib backend for graphs algorithms. So, it makes sense that we recommend our users to use the networkx's config context manager over the joblib's. Because, if a networkx user wants to use nx-parallel with some other backend(s)(like, with nx-cugraphs -- like And we only have one config system i.e. NetworkX's config, which can also be used as a context manager. And joblib's context manager will not work as expected with the config system implemented in this PR(as outlined in the blog you mentioned above). The only maintenance needed will be to update the Also, the main concern of mine(also mentioned in the blog) with the current implementation in this PR, is that the fetching of the global configs in every function call is redundant but it is not very expensive. It's like converting Thank you for your comments. I hope I addressed them all. |
Can you help me understand this better? Are we expecting every networkx backend to support running in an environment with every other networkx backend's configs? Said another way, why do we need to worry about users having two nx backends in their priority order when making nx-parallel look for joblib config values? It seems like the nx-parallel backend will look for joblib config settings and the nx-cugraph backend will look for cugraph config settings. How would these break each other? |
It looks like I should expand more on what I wrote in blog about how NetworkX's config works and how The unified configuration management system within NetworkX ( If each backend looked for its configurations separately (e.g., Addressing your questions
So, to summarise, keeping all backend configs within If you need further clarification or have additional questions, please let me know. |
Thanks for that description of the advantages of using nx.config.backends over relying on other configuration systems. I still have questions/concerns and I'll try to describe them here.
Thanks for this discussion as I think I'm learning about config systems generally as part of it. :) |
Sure, backends can have a different configs system if they want. But, in case of nx-parallel, if we only use joblib's config system, there are certain issues, like as mentioned above, a user won't be able to define global configs as joblib only offers context manager And one does not need to “put all the config options for all the backends in a single line of code”. These are the default configs: NetworkXConfig(
backend_priority=[cugraph, parallel],
backends=Config(
cugraph=<configs_for_cugraphs>,
parallel=ParallelConfig(
backend='loky',
n_jobs=None,
verbose=0,
temp_folder=None,
max_nbytes='1M',
mmap_mode='r',
prefer=None,
require=None,
inner_max_num_threads=None,
backend_params={}
)
),
cache_converted_graphs=True
) And one can modify the ones they want like this:
I hope this looks less complicated to you.
As mentioned in the Config.md, one can use the
I’m not sure if I understand this one properly... but most of the code for managing different backends and their configs is in the main networkx repo not in nx-parallel. And the conflict is that to set the joblib’s configs we need to use the joblib’s context manager which won’t be ignored in nx-cugraphs implementation and also we cannot set global configs in joblib.
Yes, afaik joblib's context manager is the only way to set the config for joblib.Parallel. No, right now a user cannot use joblib’s context to set joblib’s parameters in nx-parallel. They can but it won’t work as expected. nx-parallel configs and joblib’s configs are independent but same. Also, in joblib n_jobs is a parameter not a config, so when I say ”globally“ or “global config” I mean it in nx-parallel not joblib. Thank you :) |
Made default |
This PR adds the ability to modify the default joblib's parallel configs by integrating nx-parallel with networkx's config manager.
relevant config PRs in networkx: networkx/networkx#7363 , networkx/networkx#7225
ref.
Config.md
file in this PR for usage.ref. GSoC'24 Blog 6 for more context.
Thank you :)