-
Notifications
You must be signed in to change notification settings - Fork 202
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
number of available cpus (in cpuset) #700
Conversation
On Linux, try to find out if we're a member of a cpuset and find the number of CPUs in it. If not, continue with the old behaviour. This should also be done on BSD...
_log.info("In cpuset with %s CPUs" % numofcpus) | ||
return numofcpus | ||
except IOError, err: | ||
_log.warning("Failed to read /proc/%s/status to determine the cpuset: %s" % (mypid, err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least add an else:
with a warning log message that attempting get to determine number of available CPUs is not even attempted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right!
I think adding a pass is beter here? It's not a problem when this fails, as long as get_core_count() still works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I don't follow. When an exception is raised, it prints a warning and continues to get_core_count()
. Where do you want an else:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an else:
on the same level as if os_type == LINUX:
, that's run for e.g. OS X.
It's OK that it just falls through to use get_core_count
, but it should be explicit in the log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding a pass is beter here? It's not a problem when this fails, as long as get_core_count() still works.
A simple pass
is silent, a warning log message also passes through in the end, but at least there's something in the logs...
All done and tested. |
cpuset = re.match("^Cpus_allowed_list:\s*([0-9,-]+)", txt, re.M) | ||
if cpuset is not None: | ||
cpuset_list = cpuset.group(1).split(',') | ||
numofcpus = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use num_of_cpus
(improved readability)
@wpoely86: If you collapse the 7 lines of code into the (ugly ;-)) list comprehension line I proposed, then I consider this ready, but it'll have to wait until EB v1.9, since the feature freeze in in effect since last Friday. Do you need this urgently for something particular? As soon as I've branched off |
I don't need it any time soon. The current code works, it only gives more process than cpu's. |
Verified that unit tests work, this should be good to go in as soon as |
Hi there, how is this one being used? |
@fgeorgatos: it is used to determine the default setting for |
OK! Could we "invent" some kind of |
I don't understand what you want to do. Putting EasyBuild in a cpuset is done externally? You can set |
I was considering the case of provisioning for something like If you don't see the need for it, I'm fine to postpone for when the moment |
Well, it's easy to do. We only need to check I can add it if you find it usefull. |
That should be fairly easy to support... But maybe this should be done in a more generic way, i.e. to allow that various easyconfig parameters can be easily overridden. I'm thinking Basically, the equivalent of the |
Should we do it generally or eb specific? |
Hmm, good point @wpoely86... I think the |
+1, really like the direction this is taking; giving control externally, I'd suggest that the each time a variable is defined, the setting is On Wed, Oct 2, 2013 at 11:06 AM, Kenneth Hoste [email protected]:
|
The order of preference should be the same as with the EasyBuild configuration: i.e. command line (is this relevant in this case? |
command line is not relevant IMHO. That leaves environment > easyconfig. I will have a look at where and how to code this. The init of the easyconfig class seems a logical place. |
@wpoely86: Yes, this should be tackled in # parse easyconfig file
self.parse(path) |
The required update for But, this seems to break the unit tests on OS X (and the So, maybe we should only use the @stdweird: How portable is |
According to https://developer.apple.com/library/mac/releasenotes/Performance/RN-AffinityAPI/ there is no equivalent of @boegel can you check what |
I would stick to the old approach on Darwin, yes. Getting this 100% right (w.r.t. taskset, cpusets, etc.) is more important on Linux, but we should break this on OS X (and not only because my Mac laptop is my main development platform). On a MacBook Pro with (dual-core) Intel Core 2 Duo:
|
include latest FULL version of vsc-base
Tcl module fixes
Conflicts: vsc/README.md vsc/__init__.py vsc/utils/generaloption.py
… avaiable number of cores
…e purging *all* loaded modules
This is awaiting the merge of wpoely86#4, in which the open issues are fixed, and which makes this ready for merging in. |
long has unlimited precision. EB needs to be ready for systems with 64 or more cores ;-)
Merged wpoely86#4 I've added one commit to use long instead of int. We want easybuild to be ready for >32 core systems afterall... 😉 |
@wpoely86: I see why you've added to extra commit, it makes sense, but it's not really needed. With Python 2.6:
Nevertheless, I like the change, it makes it more explicit that it should be robust for > 32 cores. This one is now ready to go in, thanks @wpoely86! |
number of available cpus (in cpuset)
On Linux, try to find out if we're a member of a cpuset and find the
number of CPUs in it. Use this number to set the parallelism. If we're not in a cpuset, continue with
get_core_count()
.This should also be done on BSD...