Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ RUN . /tmp/versions.env \
&& curl -fsSL "https://github.com/OpenMathLib/OpenBLAS/releases/download/v${OPENBLAS_VERSION}/OpenBLAS-${OPENBLAS_VERSION}.tar.gz" \
| tar -xz -C /tmp \
&& cd "/tmp/OpenBLAS-${OPENBLAS_VERSION}" \
# musl's pthread default stack is 128 KB (vs glibc's 8 MB read from
# RLIMIT_STACK). OpenBLAS worker threads inherit it and overflow on
# DYNAMIC_ARCH Fortran kernels with large auto-arrays → SIGSEGV at the
# first BLAS3 call from MUMPS. Force an 8 MB stack on each worker.
# Guard: fail the build if the upstream anchor disappears so a silent
# OpenBLAS refactor can't reintroduce the crash.
&& grep -q 'pthread_attr_init(&attr);' driver/others/blas_server.c \
&& sed -i 's|pthread_attr_init(&attr);|pthread_attr_init(\&attr); pthread_attr_setstacksize(\&attr, 8 << 20);|' driver/others/blas_server.c \
&& grep -q 'pthread_attr_setstacksize(&attr, 8 << 20);' driver/others/blas_server.c \
&& make -j"$(nproc)" \
NO_SHARED=1 \
USE_THREAD=1 USE_OPENMP=0 \
Expand Down
8 changes: 7 additions & 1 deletion docker/rts-flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ CHUNK_MB=$((NURSERY_MB / 32))
MAX_MB=$((RAM_MB * 3 / 4))
[ $MAX_MB -lt 2048 ] && MAX_MB=2048

RTS_FLAGS="+RTS -N -M${MAX_MB}M -H${HEAP_MB}M -A${NURSERY_MB}M -n${CHUNK_MB}m -qg0 -c -F1.5 -I30 -RTS"
# -Fd1.0 (GHC 9.10+): return free heap blocks to the OS over ~1 idle period
# instead of holding them indefinitely after a parsing spike. Default decay
# (4.0) keeps RSS pinned near the peak for minutes.
# -I0.3 (GHC default): trigger idle-time major GC promptly. The previous
# -I30 deferred GC for 30 s, hiding live-data drops and starving -Fd of
# free blocks to release.
RTS_FLAGS="+RTS -N -M${MAX_MB}M -H${HEAP_MB}M -A${NURSERY_MB}M -n${CHUNK_MB}m -qg0 -c -F1.5 -Fd1.0 -I0.3 -RTS"

echo "RTS_FLAGS=\"$RTS_FLAGS\""

Expand Down
Loading