fix: use DEBUG=1 and MAKEFLAGS=-j1 in CI image to prevent EXLA OOM
The EXLA Makefile uses -O3 by default which causes massive memory usage during C++ compilation. DEBUG=1 replaces -O3 with -g, drastically reducing peak RAM. Combined with MAKEFLAGS=-j1 to serialize jobs, this should fit within CI runner memory limits.
This commit is contained in:
parent
92fb2deb5d
commit
484c59f217
2 changed files with 12 additions and 4 deletions
|
|
@ -155,7 +155,13 @@ jobs:
|
|||
sh -euc '\
|
||||
mkdir -p /app && cd /app && tar xf - && \
|
||||
mix deps.get && \
|
||||
cp -a /opt/exla-cache/cache /app/deps/exla/cache && \
|
||||
if [ -d /opt/exla-cache/cache/0.13.0 ]; then \
|
||||
rm -rf /app/deps/exla/cache && \
|
||||
cp -a /opt/exla-cache/cache /app/deps/exla/cache; \
|
||||
echo "Restored pre-built EXLA cache"; \
|
||||
else \
|
||||
echo "No pre-built EXLA cache found, will compile from source"; \
|
||||
fi && \
|
||||
mix ecto.create --quiet && \
|
||||
mix ecto.migrate --quiet && \
|
||||
mix test'
|
||||
|
|
|
|||
|
|
@ -34,9 +34,11 @@ COPY vendor /tmp/exla_warm/vendor
|
|||
RUN mkdir -p /tmp/exla_warm/config && \
|
||||
printf 'import Config\nconfig :nx, :default_backend, EXLA.Backend\n' > /tmp/exla_warm/config/config.exs
|
||||
|
||||
# Compile all deps. EXLA's cached_make downloads the XLA archive, compiles
|
||||
# the C++ NIF, and caches libexla.so at ~/.cache/xla/exla/{key}/.
|
||||
RUN mix deps.get && mix deps.compile
|
||||
# Compile all deps. DEBUG=1 tells the EXLA Makefile to use -g instead
|
||||
# of -O3 — this avoids the heavy optimization passes that OOM-kill g++
|
||||
# on low-memory CI runners. MAKEFLAGS=-j1 serializes make jobs. The
|
||||
# resulting unoptimized NIF is fine for tests.
|
||||
RUN MAKEFLAGS="-j1" DEBUG=1 mix deps.get && MAKEFLAGS="-j1" DEBUG=1 mix deps.compile
|
||||
|
||||
# Save the full build cache (libexla.so + .o files + xla_extension lib)
|
||||
# so Make finds all targets already built when restored in the test step.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue