Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llamacpp/native/cuda.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN echo "-B build \
-GNinja \
-S ." > cmake-flags
RUN cmake $(cat cmake-flags)
RUN cmake --build build --config Release
RUN cmake --build build --config Release -j$(nproc --ignore=2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: Guard against nproc --ignore=2 returning 0 parallel jobs on small-core machines.

On 1–2 core machines, nproc --ignore=2 can return 0, yielding -j0, which some build tools treat as unlimited parallelism or otherwise special-case. To avoid this, ensure a minimum of 1 job, e.g.:

RUN cmake --build build --config Release -j"$(nproc --ignore=2 || echo 1)"

or use a small shell expression to compute max(1, nproc-2) explicitly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Using nproc --ignore=2 can result in a negative or zero value if the build environment has 2 or fewer cores, causing the build command to fail. It is safer to use a shell arithmetic expansion to ensure a minimum of 1 job.

RUN cmake --build build --config Release -j$(nproc --ignore=2 | awk '{print ($1 < 1 ? 1 : $1)}')

RUN cmake --install build --config Release --prefix install

RUN rm install/bin/*.py
Expand Down
Loading