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

Rename NVM_CPU_THREADS to NVM_CPU_CORES #1326

Merged
merged 1 commit into from
Nov 26, 2016
Merged

Rename NVM_CPU_THREADS to NVM_CPU_CORES #1326

merged 1 commit into from
Nov 26, 2016

Conversation

gibfahn
Copy link
Contributor

@gibfahn gibfahn commented Nov 24, 2016

Following #1319 , rename NVM_CPU_THREADS to NVM_CPU_CORES

cc/ @GeorgeAdams95

if [ "$NVM_CPU_THREADS" -gt 2 ]; then
NVM_MAKE_JOBS=$((NVM_CPU_THREADS - 1))
nvm_echo "Set the number of jobs to $NVM_CPU_THREADS - 1 = $NVM_MAKE_JOBS jobs to speed up the build"
nvm_echo "Detected that you have $NVM_CPU_CORES CPU thread(s)"
Copy link
Member

Choose a reason for hiding this comment

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

we should probably alter this text to be more accurate too?

@gibfahn
Copy link
Contributor Author

gibfahn commented Nov 25, 2016

Updated, PTAL

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

LGTM

@PeterDaveHello
Copy link
Collaborator

Is this really correct? I think we do use CPU threads not cores directly here, for example:

Intel® Core™ i7-4790 Processor has only 4 cores but 8 threads:
http://ark.intel.com/products/80806/Intel-Core-i7-4790-Processor-8M-Cache-up-to-4_00-GHz

@ljharb ljharb merged commit 7f1917d into nvm-sh:master Nov 26, 2016
@ljharb
Copy link
Member

ljharb commented Nov 26, 2016

@PeterDaveHello then on that processor, the number of make jobs should be 3.

@PeterDaveHello
Copy link
Collaborator

It'll be 7, as you'll see 8 cores there, and it'll be faster than 3.

@ljharb
Copy link
Member

ljharb commented Nov 26, 2016

Perhaps the terms "core" and "thread" are used a bit loosely?

My intention is that there should always be at least one execution context, that is not from nvm install -s, that can run simultaneously - for example, to run kill.

@PeterDaveHello
Copy link
Collaborator

I don't think the terms "core" and "thread" are used a bit loosely, I'll call it threads but not cores, they are different, at least, call them CPUs, as other common programs, I didn't see any common case which really needs to take the physical cores rather than the threads on the cores, maybe I should just send a PR to modify it again to call it NVM_CPUS.

If you really think we should use 3 cores not 7 threads in the hyper-threading cases, you should use the cpu cores info in /proc/cpuinfo or something like lscpu but not directly count the process in it.

$ lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 30
Stepping:              5
CPU MHz:               2794.000
BogoMIPS:              5922.27
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-7

@PeterDaveHello
Copy link
Collaborator

Do we really need to use the term "CORE" here? Maybe should open an issue for the discussion?

@ljharb
Copy link
Member

ljharb commented Nov 27, 2016

Sure, an issue is great.

@gibfahn
Copy link
Contributor Author

gibfahn commented Nov 28, 2016

@PeterDaveHello I'd say that Cores is still more appropriate than threads. I agree that if you have an Intel core with hyperthreading then you can run two threads at a time on each core, but most OSs spin up a bunch of threads and context switch between them, and I'd say that's the more common meaning of threads. From the OS, a processor with 4 physical cores and hyperthreading (or a single Power8 processor) would look like 8 "virtual cores" to the OS.

My activity monitor atm:
image

Task manager:
image

Happy to discuss further on an issue!

@PeterDaveHello
Copy link
Collaborator

@gibfahn just reply to your activity monitor here, the threads term here is not about how many threads we have on CPU but how many threads the software created on the OS.

@ljharb
Copy link
Member

ljharb commented Nov 28, 2016

@PeterDaveHello that's what "threads" most commonly means to programmers - software threads created by the OS.

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.

None yet

3 participants