bugmake - Bugs: bug #64543, Fix "make -j" for Docker...

 
 

bug #64543: Fix "make -j" for Docker container

Submitter:  qwertytmp1
Submitted:  Fri 11 Aug 2023 11:45:10 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.1 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 06 Jan 2024 05:50:41 PM UTC, comment #2: 

Thanks for the update.  Closing.

Paul D. Smith <psmith>
Group administrator
Thu 17 Aug 2023 12:33:36 PM UTC, comment #1: 

original submission:

> The problem is in fact, that the Make probably uses:
> ```
> cat /proc/cpuinfo
> ```
>
> mechanism to detect the number of CPUs available to Make.
>
>
> However this way will not always work correctly inside of Docker container which was started using limited set of cores, for example:
> ```
> docker run -it --cpuset-cpus=0,1 ubuntu
> ```
>
> Following way of detection for available CPUs should be used instead:
> ```
> cat /sys/fs/cgroup/cpuset/cpuset.cpus
> ```


There is no issue in "make" utility.

The problem is in how it was used inside of Docker container by me.

I've used:
```
NUM_CPUS=$(grep -c ^processor /proc/cpuinfo)
make -j$(NUM_CPUS)
```

inside of Docker container, but this was my mistake.

There is no problem when using simply:
```
make -j
```

Dear admins, feel free to close this bug report.

qwertytmp1
Fri 11 Aug 2023 11:45:10 AM UTC, original submission:  

The problem is in fact, that the Make probably uses:
```
cat /proc/cpuinfo
```

mechanism to detect the number of CPUs available to Make.


However this way will not always work correctly inside of Docker container which was started using limited set of cores, for example:
```
docker run -it --cpuset-cpus=0,1 ubuntu
```

Following way of detection for available CPUs should be used instead:
```
cat /sys/fs/cgroup/cpuset/cpuset.cpus
```

qwertytmp1

 

(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 psmith (Posted a comment)
  • -email is unavailable- added by qwertytmp1 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-06 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code