diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..1a8d789 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,34 @@ +########## Stage 1: Large image to build toolchains and emulator ########## +FROM ubuntu:22.04 AS builder + +RUN DEBIAN_FRONTEND=noninteractive \ + apt-get update && \ + apt-get upgrade && \ + apt-get install -y --no-install-recommends \ + bzip2 \ + ca-certificates \ + cmake \ + curl \ + gcc \ + git \ + git-lfs \ + g++ \ + make \ + python3 \ + python3-pip \ + python-is-python3 \ + zlib1g-dev \ + && apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +COPY requirements-pip.txt requirements-pulp-sdk.txt ./ +RUN pip3 install --no-cache-dir -r requirements-pip.txt -r requirements-pulp-sdk.txt --extra-index-url https://download.pytorch.org/whl/cpu + +ENV PULP_SDK_HOME="/pulp-sdk" +ENV PULP_RISCV_GCC_TOOLCHAIN="/toolchains/pulp-riscv-gnu-toolchain" + +COPY docker/get_pulp_riscv_gnu_toolchain.sh ./ +RUN ./get_pulp_riscv_gnu_toolchain.sh + +COPY docker/get_pulp_sdk.sh ./ +RUN ./get_pulp_sdk.sh diff --git a/test/docker/get_pulp_riscv_gnu_toolchain.sh b/test/docker/get_pulp_riscv_gnu_toolchain.sh new file mode 100755 index 0000000..ab6208a --- /dev/null +++ b/test/docker/get_pulp_riscv_gnu_toolchain.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -euo pipefail + +curl -L https://github.com/pulp-platform/pulp-riscv-gnu-toolchain/releases/download/v1.0.16/v1.0.16-pulp-riscv-gcc-ubuntu-18.tar.bz2 > pulp-riscv-gnu-toolchain.tar.bz2 +mkdir toolchains +tar -xvjf ./pulp-riscv-gnu-toolchain.tar.bz2 -C ./toolchains +mv ./toolchains/v1.0.16-pulp-riscv-gcc-ubuntu-18 ./toolchains/pulp-riscv-gnu-toolchain +rm ./pulp-riscv-gnu-toolchain.tar.bz2 diff --git a/test/docker/get_pulp_sdk.sh b/test/docker/get_pulp_sdk.sh new file mode 100755 index 0000000..665e184 --- /dev/null +++ b/test/docker/get_pulp_sdk.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -eo pipefail + +git clone https://github.com/Scheremo/pulp-sdk.git --branch scheremo --depth=1 && rm -rf pulp-sdk/.git + +cd pulp-sdk + +source configs/siracusa.sh +make all diff --git a/test/requirements.txt b/test/requirements-conda.txt similarity index 72% rename from test/requirements.txt rename to test/requirements-conda.txt index eee0644..2770601 100644 --- a/test/requirements.txt +++ b/test/requirements-conda.txt @@ -1,4 +1,4 @@ -numpy +numpy==1.26.4 pydantic pytest pytorch==1.11.0 diff --git a/test/requirements-pip.txt b/test/requirements-pip.txt new file mode 100644 index 0000000..76adfa4 --- /dev/null +++ b/test/requirements-pip.txt @@ -0,0 +1,6 @@ +numpy==1.26.4 +pydantic +pytest +torch==1.11.0 +toml +ninja diff --git a/test/requirements-pulp-sdk.txt b/test/requirements-pulp-sdk.txt new file mode 100644 index 0000000..c7719e6 --- /dev/null +++ b/test/requirements-pulp-sdk.txt @@ -0,0 +1,4 @@ +argcomplete +pyelftools +scons +six