ZMC2019's picture
Reorganise: group 313 tasks into 17 families under tasks/, generators under tools/ (part 8)
995e752 verified
Raw History Blame Contribute Delete
2.68 kB
# Kernel-generation task: Write a fast 8-bit blockwise AdamW kernel (quantised optimiser state)
#
# Adam's two moment buffers are twice the size of the model, which is why 8-bit optimisers exist: each moment is stored as a byte index into a nonlinear 256-entry map plus one fp32 absmax per 2048-element block. Every step has to dequantise both moments through that map, take the AdamW step, and requantise against a NEW block absmax that is not known until the whole block's new moment exists. It is the memory-heaviest kernel in the training loop and it is all bandwidth and lookups.
#
# SCORING: correctness is a hard gate; the score is achieved GB/s (uncapped leaderboard, 0 if wrong).
# There is no gold solution and no oracle, so nothing has to be vendored or sealed.
#
# TOOLCHAIN POLICY: the agent writes the kernel with Triton (+Gluon), CUDA C++ via nvcc, CUTLASS headers, or
# the CuTe DSL. Enforcement is by ABSENCE, not by scanning: only the permitted toolchain is installed and
# there is no internet, so nothing else can be obtained.
#
# GENERATED by _factory/build.py.
FROM pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
# NOTE: every heavy layer comes FIRST and depends only on {base_image, pip_extra}, so all tasks in this
# lane share the same cached layers. The task-specific COPYs are LAST. Do not reorder.
RUN pip install --break-system-packages --no-cache-dir einops nvidia-cutlass-dsl && \
apt-get update && apt-get install -y --no-install-recommends iptables iproute2 curl ca-certificates build-essential git && \
curl -LsSf https://astral.sh/uv/install.sh | sh && \
/root/.local/bin/uv tool install mini-swe-agent
# header-only CUTLASS for the agent's CUDA/CuTe route
RUN git clone --depth 1 https://github.com/NVIDIA/cutlass /opt/cutlass && rm -rf /opt/cutlass/.git
# pre-bake Claude Code; harbor's claude_code.install() skips when present
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs procps && \
npm install -g @anthropic-ai/claude-code && claude --version
ENV PATH=/root/.local/bin:$PATH
ENV DISABLE_TELEMETRY=1 DISABLE_AUTOUPDATER=1 DISABLE_ERROR_REPORTING=1 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
COPY restrict-network.sh /app/restrict-network.sh
RUN chmod +x /app/restrict-network.sh
# strip apt sources LAST so harbor's post-firewall apt step is a no-op that succeeds
RUN rm -rf /var/lib/apt/lists/* /etc/apt/sources.list /etc/apt/sources.list.d
WORKDIR /app
COPY CLAUDE.md PROCESS_MANAGEMENT.md /app/
# task-specific files LAST so the layers above stay shared across every task
COPY reference.py /app/reference.py
COPY measure.py /app/measure.py
COPY qadam.py /app/qadam.py