Skip to content

Conversation

wuwenrui555
Copy link

Fix bug that there are more processes than expected after setting n_jobs in phenograph.cluster() function.

row indices, column indices, and nonzero values for a sparse adjacency matrix
"""
if n_jobs == -1:
n_jobs = cpu_count()
Copy link

@jpintar jpintar Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not use multiprocessing.cpu_count() here – in HPC contexts it won't always correctly pick up how many cores your job has been allocated, but the total core count of the node. It's safer to use len(os.sched_getaffinity(0)) instead (there's also os.process_cpu_count() introduced in Python 3.13).

Hopefully this pull request gets incorporated... Not sure how actively Phenograph is being maintained...

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 this pull request may close these issues.

2 participants