Skip to content

Commit 2872200

Browse files
authored
LLVM 18 (#34)
* gh: bump cpp and python submodules * tasks: change usage of dict for getter method * gha: bump cpp and python tags * tasks(docker): remove remanents of service and use base image * examples(kernels): fix compilation with llvm 17 * lulesh: fix cross-compilation with llvm 17 * examples(tensorflow): fix compilation for llvm 17 * examples(ffmpeg): fix func ompilation * examples(imagemagick): cross-compilation works with llvm 17 * cpp: bump to latest version * gha: fix release gha workflow * examples(kernels): bump submodule commit * examples(kernels): fix compilation of native kernels * func(tf): fix compilation * docker: fix dockerfile * nits: self-rewiew * gha: run omp kernels with wamr * examples(kernels): prepare omp kernels to run with wamr * cpp: bump to latest commit * gh: bump cpp and python after merge to main * gha: debug wavm failure * gha: print upload logs on failure * gha: change how we cache wasm * gha: more wavm investigation * gha: fix wavm wasm upload issue * gha: comment out another wavm app
1 parent dbb4e33 commit 2872200

26 files changed

+284
-257
lines changed

.github/workflows/release.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ jobs:
2626
submodules: true
2727
- name: "Set version variables"
2828
run: |
29-
FAASM_VER=$(cat FAASM_VERSION)
3029
CPP_VER=$(cat cpp/VERSION)
3130
PYTHON_VER=$(cat python/VERSION)
32-
echo "FAASM_VERSION=$FAASM_VER" >> $GITHUB_ENV
3331
echo "CPP_VERSION=$CPP_VER" >> $GITHUB_ENV
3432
echo "PYTHON_VERSION=$PYTHON_VER" >> $GITHUB_ENV
3533
echo "EXAMPLES_VERSION=${CPP_VER}_${PYTHON_VER}" >> $GITHUB_ENV
@@ -43,6 +41,16 @@ jobs:
4341
registry: faasm.azurecr.io
4442
username: ${{ secrets.ACR_SERVICE_PRINCIPAL_ID }}
4543
password: ${{ secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}
44+
- name: "Build and push examples-base image"
45+
uses: docker/build-push-action@v5
46+
with:
47+
push: true
48+
file: docker/base.dockerfile
49+
build-args: |
50+
OPENMPI_VERSION=4.1.0
51+
OPENMPI_VERSION_NOPATCH=4.1
52+
context: .
53+
tags: faasm.azurecr.io/examples-base:${{ env.EXAMPLES_VERSION }}
4654
- name: "Build and push examples-build image"
4755
uses: docker/build-push-action@v4
4856
with:

.github/workflows/tests.yml

+32-34
Original file line numberDiff line numberDiff line change
@@ -33,40 +33,32 @@ jobs:
3333
if: github.event.pull_request.draft == false
3434
runs-on: ubuntu-latest
3535
outputs:
36-
needs-wasm: ${{ (steps.filter.outputs.examples-changed == 'true') || (steps.wasm-cache.outputs.cache-hit != 'true') }}
36+
needs-wasm: ${{ steps.wasm-cache.outputs.cache-hit != 'true' }}
3737
steps:
3838
- name: "Checkout code"
3939
uses: actions/checkout@v4
40-
# Check if any of the submodules have been modified
41-
- uses: dorny/paths-filter@v3
42-
id: filter
4340
with:
44-
filters: |
45-
examples-changed:
46-
- './examples/**'
41+
submodules: true
4742
# Check if we have a WASM cache hit
48-
- name: "Get CPP/Python commits"
43+
- name: "Get digest of all submodules"
4944
id: submodule-commit
5045
run: |
51-
git submodule update --init ./cpp
52-
git submodule update --init ./python
5346
sudo apt install -y zstd
5447
git config --global --add safe.directory "$GITHUB_WORKSPACE"
55-
echo "cpp-commit=$(git submodule status ./cpp | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
56-
echo "py-commit=$(git submodule status ./python | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
48+
echo "digest=$(git submodule status | awk '{ print $1; }' | md5sum | cut -d' ' -f1)" >> $GITHUB_OUTPUT
5749
- uses: actions/cache/restore@v4
5850
id: wasm-cache
5951
with:
6052
path: ./wasm
61-
key: wasm-${{ steps.submodule-commit.outputs.cpp-commit }}-${{ steps.submodule-commit.outputs.py-commit }}
53+
key: wasm-${{ steps.submodule-commit.outputs.digest }}
6254
lookup-only: true
6355

6456
build-examples:
6557
needs: needs-build
6658
if: ${{ needs.needs-build.outputs.needs-wasm == 'true' }}
6759
runs-on: ubuntu-latest
6860
container:
69-
image: faasm.azurecr.io/examples-build:0.3.1_0.3.1
61+
image: faasm.azurecr.io/examples-build:0.4.0_0.4.0
7062
credentials:
7163
username: ${{ secrets.ACR_SERVICE_PRINCIPAL_ID }}
7264
password: ${{ secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}
@@ -100,8 +92,7 @@ jobs:
10092
run: |
10193
apt install -y zstd
10294
git config --global --add safe.directory "$GITHUB_WORKSPACE"
103-
echo "cpp-commit=$(git submodule status ./cpp | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
104-
echo "py-commit=$(git submodule status ./python | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
95+
echo "digest=$(git submodule status | awk '{ print $1; }' | md5sum | cut -d' ' -f1)" >> $GITHUB_OUTPUT
10596
# Also move to a different path to restore from
10697
mv /usr/local/faasm/wasm ./wasm
10798
# If we are here we _always_ want to overwrite the cache
@@ -110,7 +101,7 @@ jobs:
110101
if: always()
111102
with:
112103
path: ./wasm
113-
key: wasm-${{ steps.submodule-commit.outputs.cpp-commit }}-${{ steps.submodule-commit.outputs.py-commit }}
104+
key: wasm-${{ steps.submodule-commit.outputs.digest }}
114105

115106
run-examples-faasmctl:
116107
needs: [build-examples]
@@ -128,9 +119,8 @@ jobs:
128119
run:
129120
shell: bash
130121
env:
131-
CONAN_CACHE_MOUNT_SOURCE: ~/.conan
132122
FAASM_INI_FILE: ./faasm.ini
133-
FAASM_VERSION: 0.21.2
123+
FAASM_VERSION: 0.22.0
134124
FAASM_WASM_VM: ${{ matrix.faasm_wasm_vm }}
135125
steps:
136126
- uses: csegarragonz/set-compose-version-action@main
@@ -149,6 +139,7 @@ jobs:
149139
remove-docker-images: 'true'
150140
remove-dotnet: 'true'
151141
remove-haskell: 'true'
142+
152143
- name: "Checkout code"
153144
uses: actions/checkout@v4
154145
- name: "Install faasmctl"
@@ -179,7 +170,11 @@ jobs:
179170
key: wasm-${{ steps.submodule-commit.outputs.cpp-commit }}-${{ steps.submodule-commit.outputs.py-commit }}
180171
fail-on-cache-miss: true
181172
- name: "Upload all WASM files to the cluster"
173+
id: wasm-upload
182174
run: ./bin/inv_wrapper.sh wasm.upload
175+
- name: "Print logs if wasm-upload fails"
176+
if: failure() && (steps.wasm-upload.outcome == 'failure')
177+
run: faasmctl logs -s upload
183178
- name: "Run MPI kernels"
184179
timeout-minutes: 2
185180
run: |
@@ -205,13 +200,12 @@ jobs:
205200
faasmctl invoke kernels-mpi p2p --cmdline '10 1024 1024' --mpi-world-size 4
206201
faasmctl invoke kernels-mpi transpose --cmdline '10 1024 32' --mpi-world-size 4
207202
- name: "Run OpenMP kernels"
208-
if: "contains(env.FAASM_WASM_VM, 'wavm')"
203+
if: "contains(env.FAASM_WASM_VM, 'wamr')"
209204
timeout-minutes: 2
210205
run: |
211206
faasmctl invoke kernels-omp global --cmdline '2 10 1024'
212207
faasmctl invoke kernels-omp p2p --cmdline '2 10 1024 1024'
213-
# The sparse OpenMP kernel fails during the result integrity checks
214-
# faasmctl invoke kernels-omp sparse --cmdline '2 10 10 5'
208+
faasmctl invoke kernels-omp sparse --cmdline '2 10 10 5'
215209
# The transpose OpenMP kernel can not be cross-compiled due to problems
216210
# with the static_for signature and symbol definition
217211
# faasmctl invoke kernels-omp transpose --cmdline '10 1024 32'
@@ -254,10 +248,11 @@ jobs:
254248
faasmctl invoke polybench poly_jacobi-1d
255249
faasmctl invoke polybench poly_jacobi-2d
256250
faasmctl invoke polybench poly_seidel-2d
257-
- name: "Run ImageMagick"
258-
if: "contains(env.FAASM_WASM_VM, 'wavm')"
259-
timeout-minutes: 1
260-
run: faasmctl invoke imagemagick main --cmdline 'faasm://im/sample_image.png -flip faasm://im/image_out.png'
251+
# TODO(wamr-tf): TF Check broken with WAVM, uncomment when WAMR supports it
252+
# - name: "Run ImageMagick"
253+
# if: "contains(env.FAASM_WASM_VM, 'wamr')"
254+
# timeout-minutes: 1
255+
# run: faasmctl invoke imagemagick main --cmdline 'faasm://im/sample_image.png -flip faasm://im/image_out.png'
261256
- name: "Run LAMMPS"
262257
timeout-minutes: 1
263258
run: faasmctl invoke lammps main --cmdline '-in faasm://lammps-data/in.controller.wall' --mpi-world-size 4
@@ -268,15 +263,18 @@ jobs:
268263
- name: "Run LAMMPS migration-net binary"
269264
timeout-minutes: 1
270265
run: faasmctl invoke lammps migration-net --cmdline '-in faasm://lammps-data/in.controller.wall' --mpi-world-size 4 --input-data '1 2 10 2'
271-
# 08/12/2023 - LULESH is broken with a memory leak
272-
# - name: "Run LULESH"
273-
# timeout-minutes: 1
274-
# if: "contains(env.FAASM_WASM_VM, 'wavm')"
275-
# run: faasmctl invoke lulesh main --cmdline '-i 5 -s 20 -r 11 -c 1 -b 1' --input-data '4'
276-
- name: "Run TFlite check"
266+
- name: "Run LULESH"
277267
timeout-minutes: 1
278-
if: "contains(env.FAASM_WASM_VM, 'wavm')"
279-
run: faasmctl invoke tf check
268+
if: "contains(env.FAASM_WASM_VM, 'wamr')"
269+
run: faasmctl invoke lulesh main --cmdline '-i 5 -s 20 -r 11 -c 1 -b 1' --input-data '4'
270+
# TODO(wamr-tf): TF Check broken with WAVM, uncomment when WAMR supports it
271+
# - name: "Run TFlite check"
272+
# timeout-minutes: 1
273+
# if: "contains(env.FAASM_WASM_VM, 'wamr')"
274+
# run: faasmctl invoke tf check
280275
- name: "Run FFmpeg check"
281276
timeout-minutes: 1
282277
run: faasmctl invoke ffmpeg check
278+
- name: "Print logs in case of failure"
279+
if: failure()
280+
run: faasmctl logs -s worker

bin/workon.sh

-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ complete -F _complete_invoke -o default invoke inv
4949
# Environment vars
5050
# ----------------------------
5151

52-
export FAASM_VERSION=$(cat ${PROJ_ROOT}/FAASM_VERSION)
5352
export CPP_VERSION=$(cat ${PROJ_ROOT}/cpp/VERSION)
5453
export PYTHON_VERSION=$(cat ${PROJ_ROOT}/python/VERSION)
5554

@@ -62,7 +61,6 @@ export PS1="(faasm-examples) $PS1"
6261
echo ""
6362
echo "----------------------------------"
6463
echo "Faasm Examples CLI"
65-
echo "Faasm Version: ${FAASM_VERSION}"
6664
echo "CPP Version: ${CPP_VERSION}"
6765
echo "Python Version: ${PYTHON_VERSION}"
6866
echo "----------------------------------"

cpp

Submodule cpp updated 61 files

docker/base.dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:22.04 as base
2+
3+
RUN apt update \
4+
&& apt install -y \
5+
bzip2 \
6+
gcc \
7+
g++ \
8+
make \
9+
wget
10+
11+
# Download and build MPI
12+
ARG OPENMPI_VERSION
13+
ARG OPENMPI_VERSION_NOPATCH
14+
RUN mkdir -p /tmp \
15+
&& cd /tmp \
16+
&& wget https://download.open-mpi.org/release/open-mpi/v${OPENMPI_VERSION_NOPATCH}/openmpi-${OPENMPI_VERSION}.tar.bz2 \
17+
&& tar xf openmpi-${OPENMPI_VERSION}.tar.bz2 \
18+
&& cd /tmp/openmpi-${OPENMPI_VERSION} \
19+
&& ./configure --prefix=/usr/local \
20+
&& make -j `nproc`

docker/build.dockerfile

+25-42
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
11
ARG CPP_VERSION
2-
FROM ubuntu:22.04 as base
3-
4-
RUN apt update \
5-
&& apt install -y \
6-
bzip2 \
7-
gcc \
8-
g++ \
9-
make \
10-
wget
11-
12-
# Download and build MPI
13-
RUN mkdir -p /tmp \
14-
&& cd /tmp \
15-
&& wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.bz2 \
16-
&& tar xf openmpi-4.1.0.tar.bz2 \
17-
&& cd /tmp/openmpi-4.1.0 \
18-
&& ./configure --prefix=/usr/local \
19-
&& make -j `nproc`
20-
21-
ARG CPP_VERSION
2+
ARG EXAMPLES_VERSION
3+
FROM faasm.azurecr.io/examples-base:${EXAMPLES_VERSION} as base
224
FROM faasm.azurecr.io/cpp-sysroot:${CPP_VERSION}
235

246
SHELL ["/bin/bash", "-c"]
@@ -36,7 +18,7 @@ RUN cd /tmp/openmpi-4.1.0 \
3618
# Install OpenMP
3719
ARG DEBIAN_FRONTEND=noninteractive
3820
RUN apt update \
39-
&& apt install -y libomp-13-dev
21+
&& apt install -y libomp-17-dev
4022

4123
# Fetch the code and update submodules
4224
ARG EXAMPLES_VERSION
@@ -53,6 +35,7 @@ RUN mkdir -p code \
5335
&& git submodule update --init -f examples/Kernels \
5436
&& git submodule update --init -f examples/lammps \
5537
&& git submodule update --init -f examples/lammps-migration \
38+
&& git submodule update --init -f examples/lammps-migration-net \
5639
&& git submodule update --init -f examples/LULESH \
5740
&& git submodule update --init -f examples/libpng \
5841
&& git submodule update --init -f examples/polybench \
@@ -63,28 +46,28 @@ RUN cd /code/examples \
6346
&& ./bin/create_venv.sh \
6447
&& source venv/bin/activate \
6548
# Build the native versions of the examples that support it
66-
&& inv \
67-
kernels --native \
68-
lammps --native \
69-
lammps --migration --native \
70-
lulesh --native \
71-
polybench --native \
72-
&& inv \
73-
ffmpeg \
74-
# ImageMagick needs libpng
75-
libpng imagemagick \
76-
kernels \
77-
lammps \
78-
lammps --migration \
79-
lulesh \
80-
polybench \
81-
tensorflow \
49+
&& inv kernels --native \
50+
&& inv lammps --native \
51+
&& inv lammps --migration --native \
52+
&& inv lammps --migration-net --native \
53+
&& inv lulesh --native \
54+
&& inv polybench --native \
55+
# Build the WASM applications
56+
&& inv ffmpeg \
57+
# ImageMagick needs libpng
58+
&& inv libpng imagemagick \
59+
&& inv kernels \
60+
&& inv lammps \
61+
&& inv lammps --migration \
62+
&& inv lammps --migration-net \
63+
&& inv lulesh \
64+
&& inv polybench \
65+
&& inv tensorflow \
8266
# These demo functions link with the cross-compiled static libraries
83-
&& inv \
84-
func ffmpeg check \
85-
func lammps chain \
86-
func mpi migrate \
87-
func tf check
67+
&& inv func ffmpeg check \
68+
&& inv func lammps chain \
69+
&& inv func mpi migrate \
70+
&& inv func tf check
8871

8972
# Prepare bashrc
9073
WORKDIR /code/examples

examples/ImageMagick

examples/LULESH

func/ffmpeg/CMakeLists.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ set(FAASM_USER ffmpeg)
22

33
# FFmpeg build
44
set(FFMPEG_INCLUDE_DIRS
5-
${CMAKE_SYSROOT}/include/libavcodec
6-
${CMAKE_SYSROOT}/include/libavformat
5+
$ENV{FAASM_WASM_HEADER_INSTALL_DIR}/libavcodec
6+
$ENV{FAASM_WASM_HEADER_INSTALL_DIR}/libavformat
77
)
88
set(FFMPEG_LIBS
9-
${CMAKE_SYSROOT}/lib/wasm32-wasi/libavcodec.a
10-
${CMAKE_SYSROOT}/lib/wasm32-wasi/libavformat.a
11-
${CMAKE_SYSROOT}/lib/wasm32-wasi/libavutil.a
12-
${CMAKE_SYSROOT}/lib/wasm32-wasi/libswscale.a
13-
${CMAKE_SYSROOT}/lib/wasm32-wasi/libswresample.a
9+
$ENV{FAASM_WASM_LIB_INSTALL_DIR}/libavcodec.a
10+
$ENV{FAASM_WASM_LIB_INSTALL_DIR}/libavformat.a
11+
$ENV{FAASM_WASM_LIB_INSTALL_DIR}/libavutil.a
12+
$ENV{FAASM_WASM_LIB_INSTALL_DIR}/libswscale.a
13+
$ENV{FAASM_WASM_LIB_INSTALL_DIR}/libswresample.a
1414
)
1515

1616
faasm_example_func(check check.cpp)

func/tf/CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
set(FAASM_USER tf)
22

3-
set(TF_LIB ${CMAKE_SYSROOT}/lib/wasm32-wasi/libtensorflow-lite.a)
3+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --target=$ENV{FAASM_WASM_TRIPLE} -pthread")
4+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --target=$ENV{FAASM_WASM_TRIPLE} -pthread")
5+
set(CMAKE_EXE_LINKER_FLAGS "$ENV{FAASM_WASM_EXE_LINKER_FLAGS}")
6+
7+
set(TF_LIB libtensorflow-lite.a)
48

59
faasm_example_func(check check.cpp)
610

711
set(TF_HEADERS
8-
${CMAKE_SYSROOT}/include/tensorflow
9-
${CMAKE_SYSROOT}/include/tensorflow/tensorflow/lite/tools/make/downloads/flatbuffers/include
12+
$ENV{FAASM_WASM_HEADER_INSTALL_DIR}/tensorflow
13+
$ENV{FAASM_WASM_HEADER_INSTALL_DIR}/tensorflow/tensorflow/lite/tools/make/downloads/flatbuffers/include
1014
)
1115

1216
target_include_directories(tf_check PUBLIC ${TF_HEADERS})

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
black>=22.3.0
2-
faasmctl>=0.29.0
2+
faasmctl>=0.32.0
33
flake8>=4.0.1
44
invoke>=1.7.1
55
PyYAML>=6.0.1

tasks/cli.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313

1414

1515
@task(default=True)
16-
def cli(ctx, service, clean=False):
16+
def cli(ctx, clean=False):
1717
"""
18-
Get a shell into one of the containers: `build` or `run`
18+
Get a shell into the examples build container
1919
"""
20+
service = "build"
21+
2022
if clean:
2123
# Clean existing build
2224
if exists(DEV_FAASM_LOCAL):

0 commit comments

Comments
 (0)