[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] Detecting available CPUs instead of hardware CPUs



On 01/12/2016 05:16 PM, Marco Mambelli wrote:
Hi,
if I start condor in a condor slot and do not set NUM_CPUS, then condor (the starting one) is detecting the hardware CPUs, not the ones that the slot is providing to it (and not the requested ones in request_cpus).
E.g. in a node with 8 cpus and 2 equal slots (4 cpus each), condor starting in one of the slots thinks to have 8 cpus, even if the job that is starting the new condor had request_cpus=4.

I have 2 questions:
1. I observed this in 8.4, is it the desired behavior in all versions?
2. If I want to manually change the NUM_CPUS in the configuration of the condor that I’m starting within the slot, which is the best way to detect the CPUS available (something that works for static and dynamic slots)?


Marco:

Every HTCondor job has a copy of the machine ad, as it existed when the job started, written to the sandbox directory. The environment variable _CONDOR_MACHINE_AD points to this file. This ad will have an attribute "Cpus", set to the number of provisioned Cpus by the base HTCondor. If your glidein script can parse this file, and set NUM_CPUS for the glided-in HTCondor, I think you'll have what you need. This will work for static and partitionable slots. I think you can even use condor_status to parse the file with:

condor_status -ads $_CONDOR_MACHINE_AD -af Cpus

-greg