bugGNU Octave - Bugs: bug #55643, nproc reports fewer available...

 
 

bug #55643: nproc reports fewer available cores on OpenSUSE (via sched_setaffinity)

Submitted by:  Oliver Mössinger <olivpass>
Submitted on:  Mon 04 Feb 2019 02:52:57 PM UTC  
 
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Incorrect Result
Status:  Works For Me Assigned to:  None
Originator Name:  Oliver Mössinger Open/Closed:  Closed
Release:  5.0.91 Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Tue 05 Feb 2019 04:29:03 PM UTC, comment #10:

I think it is correct that Octave's nproc does not use "all" by default. Should nproc use "overridable" by default to be compatible with the nproc system command? That's what I would expect and prefer.

Other than that, it seems to me that this bug is resolved as working correctly and can be closed.

Just for my own education, where is the sched_setaffinity being done on OpenSUSE? Is this a global default configuration, was this an accident, is this configurable by the user? In case this comes up again it would be good to know how this works.

Mike Miller <mtmiller>
Project Administrator
Tue 05 Feb 2019 09:36:35 AM UTC, comment #9:

Okay, I got confused by nproc and I am pretty sure Octave behaves correctly.

Without Octave on my system

Octave 4.2.2 (distro):

Octave 50.0.90 (self compiled):

A solution might be to return "nproc all" by default or a better documentation what is returned: that is the minimum of OMP_NUM_THREADS and the detected number of processors. The question is, does Octave regard OMP_NUM_THREADS for all of its computations?

File "libgnu/nproc.c":

Kai Torben Ohlhus <siko1056>
Project Member
Tue 05 Feb 2019 08:42:20 AM UTC, comment #8:

You are right, also my Octave 5.0.90 installation can be fooled by the environment variable OMP_NUM_THREADS (see bug #51643). And I can even turn my laptop into a supercomputer :D

Kai Torben Ohlhus <siko1056>
Project Member
Tue 05 Feb 2019 08:41:06 AM UTC, comment #7:

Workaround:

This code deactivates the syscall sched_setaffinity() and this fixes the processor count.

Oliver Mössinger <olivpass>
Tue 05 Feb 2019 08:22:40 AM UTC, comment #6:

Have a look:

local ms@itms:~> octave --eval 'system ("nproc"); system ("nproc --all"); nproc'
1
8
ans = 1
local ms@itms:~> OMP_NUM_THREADS=6 octave --eval 'system ("nproc"); system ("nproc --all"); nproc'
6
8
ans = 1

Oliver Mössinger <olivpass>
Mon 04 Feb 2019 07:16:34 PM UTC, comment #5:

You might also try

at the Octave prompt to see if you get different results in Octave's runtime environment for some reason.

If you're getting the same result with your own compiled copy of Octave 6 from the default branch, that's using a pretty up to date version of gnulib.

Mike Miller <mtmiller>
Project Administrator
Mon 04 Feb 2019 04:54:05 PM UTC, comment #4:

We use a gnulib function to get the info. Maybe there was a bug in that function that was fixed after Octave 4.2.2 or 4.4.1 was released?

John W. Eaton <jwe>
Project Administrator
Mon 04 Feb 2019 04:44:14 PM UTC, comment #3:

Strange. On the same version of openSUSE, `nproc` and `nproc --all` both return 16 in a terminal. Then Octave 4.4.1 and Octave 6.0 both return 1 for `nproc` and 16 for `nproc all`

Guillaume <gyom>
Mon 04 Feb 2019 04:41:25 PM UTC, comment #2:

This works for me with Ubuntu 18.04.

Do you see the same for:
?

Markus Mützel <mmuetzel>
Project Member
Mon 04 Feb 2019 04:21:57 PM UTC, comment #1:

Thank you for your bug report. I also run openSUSE LEAP 15.0 and can confirm that for the distributed Octave 4.2.2 (and Octave 4.4.1 from the experimental "science" repository) `nproc` reports only 1 processor on my machine.

For the upcoming release (Octave 5.0.90, self-compiled) the reported number is correct. I cannot point to the fix, but it must have been fixed somewhere along the line.

Thus all we can do for now is to wait for Octave 5.1.0 to be part of openSUSE LEAP, or you try other ways to obtain a more recent version of Octave.

Kai Torben Ohlhus <siko1056>
Project Member
Mon 04 Feb 2019 02:52:57 PM UTC, original submission:

local ms@itms:~> nproc
8
local ms@itms:~> octave --eval 'nproc'
ans = 1
local ms@itms:~> cat /proc/version
Linux version 4.12.14-lp150.12.45-default (geeko@buildhost) (gcc version 7.3.1 20180323 [gcc-7-branch revision 258812] (SUSE Linux) ) #1 SMP Mon Jan 14 20:29:59 UTC 2019 (7a62739)
local ms@itms:~> cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

Oliver Mössinger <olivpass>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by olivpass (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 15 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-26 mtmiller Open/ClosedOpen => Closed
    2019-02-05 mtmiller Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        StatusConfirmed => Works For Me
        SummaryFunction "nproc" just reports the environment variable OMP_NUM_THREADS not the "current number of available processors". => nproc reports fewer available cores on OpenSUSE (via sched_setaffinity)
    2019-02-05 siko1056 Severity2 - Minor => 3 - Normal
        Priority3 - Low => 5 - Normal
        StatusWorks For Me => Confirmed
        Release4.2.2 => 5.0.91
        SummaryMissing some of my processor cores (nproc) => Function "nproc" just reports the environment variable OMP_NUM_THREADS not the "current number of available processors".
    2019-02-04 siko1056 CategoryPerformance => Interpreter
        Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        Item GroupPerformance => Incorrect Result
        StatusNone => Works For Me

    Back to the top


    Powered by Savane 3.4