Skip to content

utils: Add usable_cpu_count - #296

Merged
mihaic merged 2 commits into
brainiak:masterfrom
mihaic:psutil
Nov 11, 2017
Merged

mihaic merged 2 commits into
brainiak:masterfrom
mihaic:psutil

Conversation

@mihaic

@mihaic mihaic commented Nov 10, 2017

Copy link
Copy Markdown
Member

We can remove this and rely only on os.sched_getaffinity when it
supports the same OSes as psutil. See issue #291.

See also https://bugs.python.org/issue26692.

We can remove this and rely only on `os.sched_getaffinity` when it
supports the same OSes as `psutil`. See issue brainiak#291.

See also https://bugs.python.org/issue26692.
Comment thread brainiak/fcma/voxelselector.py Outdated
raw_data2=None,
voxel_unit=64,
process_num=4,
process_num=None,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The process_num was intentionally set to be 4, a small number, instead of the "usable cpus" in the system because on a cluster node, the "usable cpus" could be over 30, which will likely blow up the memory for having the process duplicate so many copies.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The memory for forked processes is allocated copy-on-write. Unless _cross_validation_for_one_voxel allocates a lot of data, it should be fine to have lots of processes in the pool.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand this. Previously we observed memory blowout when process_num was set to be "usable cpus". So I would say yes...

@yidawang yidawang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me for the FCMA part as well as utils.py

@xiazhu

xiazhu commented Nov 11, 2017

Copy link
Copy Markdown
Contributor

looks good.

@mihaic
mihaic merged commit e104d9b into brainiak:master Nov 11, 2017
@mihaic
mihaic deleted the psutil branch November 11, 2017 00:41
@davidt0x

Copy link
Copy Markdown
Contributor

Just wanted to give a heads up that I gave it a test run on della and it seems resolve the issue.

danielsuo pushed a commit that referenced this pull request Nov 16, 2017
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.

4 participants