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

Meta-data extraction #280

Closed
mgt16-LANL opened this issue Feb 28, 2024 · 4 comments · Fixed by #283
Closed

Meta-data extraction #280

mgt16-LANL opened this issue Feb 28, 2024 · 4 comments · Fixed by #283

Comments

@mgt16-LANL
Copy link

Hi - is there any way to get information such as the number of cores, number of threads, and number of gpus from the executor class? I'm imagining this would be useful for automated meta-data extraction/storage when you might have a few executors going at once.

@jan-janssen
Copy link
Member

jan-janssen commented Feb 29, 2024

Hi @mgt16-LANL , there is no official storage of the meta-data, still you can access it via:

from pympipool import Executor
exe = Executor(max_workers=2, cores_per_worker=2)
exe._process._kwargs
>>> {'future_queue': <queue.Queue at 0x10c1f2f50>,
>>>  'max_workers': 2,
>>>  'executor_class': pympipool.mpi.executor.PyMPISingleTaskExecutor,
>>>  'hostname_localhost': False,
>>>  'cores': 2,
>>>  'oversubscribe': False,
>>>  'init_function': None,
>>>  'cwd': None}

@mgt16-LANL
Copy link
Author

Thanks @jan-janssen , unfortunately this doesn't work on all other Executors:

from pympipool.flux import PyFluxExecutor
exe = PyFluxExecutor(max_workers=2)
exe._process._kwargs

Gives:

AttributeError: 'list' object has no attribute '_kwargs'

However, I found a workaround with just referencing the first index in the exe._process list:

exe._process.[0]_kwargs

This is similar on both the Slurm and Flux executors from my tests. Is this a reliable way to access the meta-data? or is there a chance the relevant meta-data for an executor might be in a another _process from the list?

@jan-janssen
Copy link
Member

This is similar on both the Slurm and Flux executors from my tests. Is this a reliable way to access the meta-data? or is there a chance the relevant meta-data for an executor might be in a another _process from the list?

Sorry, I tested on a slightly older version. The meta data is the same on all processes in the list. Basically each process is connected to one worker but still they all get a copy of the whole meta data communicated. The only thing that is missing is the max_workers variable. This can be extracted based on the list of processes: len(exe._process)

Updated example:

from pympipool import Executor
exe = Executor(max_workers=2, cores_per_worker=2)
exe._process[0]._kwargs
>>> {'future_queue': <queue.Queue at 0x10ed8c0d0>,
>>>  'cores': 2,
>>>  'interface_class': pympipool.shared.interface.MpiExecInterface,
>>>  'hostname_localhost': False,
>>>  'init_function': None,
>>>  'cwd': None,
>>>  'oversubscribe': False}

@mgt16-LANL
Copy link
Author

Thanks! That's super clear - and very helpful!

@jan-janssen jan-janssen linked a pull request Feb 29, 2024 that will close this issue
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 a pull request may close this issue.

2 participants