Refactor tensor containers (#222) #329
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: trajectory | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-wasm: | |
runs-on: ubuntu-latest | |
container: | |
image: juniorrojas/llvm-enzyme:latest | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
- name: Build WASM | |
run: | | |
export LLVM_BIN_DIR=/usr/lib/llvm-11/bin | |
export ENZYME=/Enzyme/enzyme/build/Enzyme/LLVMEnzyme-11.so | |
./build.sh | |
- name: Upload WASM | |
uses: actions/upload-artifact@v4 | |
with: | |
name: algovivo.wasm | |
path: build/algovivo.wasm | |
generate-trajectory: | |
runs-on: ubuntu-latest | |
needs: build-wasm | |
env: | |
OUTPUT_DIRNAME: trajectory.out | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
- name: Download WASM build | |
uses: actions/download-artifact@v4 | |
with: | |
name: algovivo.wasm | |
path: build/ | |
- name: Generate trajectory data | |
run: node test/neural/generateTrajectory.js | |
- name: Upload trajectory output | |
uses: actions/upload-artifact@v4 | |
with: | |
name: trajectory-output | |
path: ${{ env.OUTPUT_DIRNAME }} | |
- name: Check trajectory output | |
run: | | |
test -d ${{ env.OUTPUT_DIRNAME }} || (echo "Directory does not exist" && exit 1) | |
diff -r ${{ env.OUTPUT_DIRNAME }} test/neural/data/trajectory || (echo "Files do not match" && exit 1) | |
# render-trajectory does not depend on generate-trajectory because render-trajectory uses the reference trajectory data | |
# which already exists in the repo, while generate-trajectory checks that the current version of the code generates the same | |
# trajectory that is already stored in the repo. | |
render-trajectory: | |
runs-on: ubuntu-22.04 | |
needs: build-wasm | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
- name: Download WASM build | |
uses: actions/download-artifact@v4 | |
with: | |
name: algovivo.wasm | |
path: build/ | |
- name: Build | |
run: | | |
npm ci | |
npm run build | |
- name: Generate trajectory frames | |
run: | | |
node utils/trajectory/renderTrajectory.js | |
env: | |
MESH_FILENAME: test/neural/data/mesh.json | |
STEPS_DIRNAME: test/neural/data/trajectory | |
- name: Install ffmpeg | |
run: | | |
sudo apt-get update | |
sudo apt-get install ffmpeg | |
- name: Make trajectory video | |
run: | | |
ffmpeg -framerate 30 -i frames.out/%d.png -pix_fmt yuv420p video.out.mp4 -y | |
- name: Upload trajectory video | |
uses: actions/upload-artifact@v4 | |
with: | |
name: video | |
path: video.out.mp4 |