name: Composite CPU Test Run inputs: target_test_ref: description: 'Target ref to checkout and run CPU tests on' required: true type: string runs: using: composite steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.target_test_ref }} - name: Install Python uses: actions/setup-python@v4 with: python-version: "3.8" cache: "pip" cache-dependency-path: "**/requirements*.txt" - name: Upgrade Pip shell: bash run: python -m pip install --upgrade pip - name: Set up Docker repository shell: bash run: | # Add Docker's official GPG key: sudo apt-get update -y sudo apt-get install ca-certificates curl -y sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update - name: Docker installation shell: bash run: | sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y sudo docker run hello-world - name: Prepare data shell: bash run: | python prepare_data.py -d ./data - name: Remove previous container shell: bash run: | if docker ps -a | grep -q "$CONTAINER"; then echo "Container already exists, deleting it..." docker rm -f $CONTAINER fi env: CONTAINER: gpt-neox-${{ inputs.target_test_ref }} - name: Create container shell: bash run: | mv docker-compose.yml .docker-compose.yml cp tests/cpu_tests/docker-compose.yml . export NEOX_DATA_PATH='./data/enwik8' export NEOX_CHECKPOINT_PATH='/mnt/sda/checkpoints' #todo: where do I get this? docker compose run -d --build --name $CONTAINER gpt-neox tail -f /dev/null env: CONTAINER: gpt-neox-${{ inputs.target_test_ref }} - name: Install test requirements shell: bash run: | docker exec $CONTAINER pip install -r /workspace/requirements-dev.txt env: CONTAINER: gpt-neox-${{ inputs.target_test_ref }} - name: Execute CPU tests 1 shell: bash run: | docker exec $CONTAINER sh -c "cd gpt-neox && pytest tests -m cpu" env: CONTAINER: gpt-neox-${{ inputs.target_test_ref }} - name: Execute CPU tests 2 if: always() shell: bash run: | docker exec $CONTAINER sh -c "cd gpt-neox && PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest tests -m cpu" env: CONTAINER: gpt-neox-${{ inputs.target_test_ref }} # - name: Generate report # shell: bash # if: always() # run: | # docker exec $CONTAINER python -m http.server --directory htmlcov 8000 # this may not work with AWS - should perhaps pass back as an artifact for Github to use instead. # env: # CONTAINER: gpt-neox-${{ inputs.target_test_ref }} - name: Remove CPU docker-compose shell: bash if: always() run: | rm docker-compose.yml mv .docker-compose.yml docker-compose.yml