Skip to content

Commit d9a20c3

Browse files
authored
kernels(mpi): enable WAMR support (#30)
* examples(mpi-kernels): enable mpi kernels with latest faasm version * gha: bump faasm version again * chore: remove unnecessary run container * deps(faasmctl): bump to version 0.28.0 * chore: add pyyaml to requirements.txt
1 parent eae2a29 commit d9a20c3

File tree

9 files changed

+32
-146
lines changed

9 files changed

+32
-146
lines changed

.github/workflows/release.yml

+5-15
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: "Get the code"
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
with:
2626
submodules: true
2727
- name: "Set version variables"
@@ -34,17 +34,17 @@ jobs:
3434
echo "PYTHON_VERSION=$PYTHON_VER" >> $GITHUB_ENV
3535
echo "EXAMPLES_VERSION=${CPP_VER}_${PYTHON_VER}" >> $GITHUB_ENV
3636
- name: "Set up QEMU"
37-
uses: docker/setup-qemu-action@v2
37+
uses: docker/setup-qemu-action@v3
3838
- name: "Set up Docker Buildx"
39-
uses: docker/setup-buildx-action@v2
39+
uses: docker/setup-buildx-action@v3
4040
- name: "Log in to DockerHub"
41-
uses: docker/login-action@v2
41+
uses: docker/login-action@v3
4242
with:
4343
registry: faasm.azurecr.io
4444
username: ${{ secrets.ACR_SERVICE_PRINCIPAL_ID }}
4545
password: ${{ secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}
4646
- name: "Build and push examples-build image"
47-
uses: docker/build-push-action@v3
47+
uses: docker/build-push-action@v4
4848
with:
4949
push: true
5050
file: docker/build.dockerfile
@@ -54,13 +54,3 @@ jobs:
5454
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
5555
context: .
5656
tags: faasm.azurecr.io/examples-build:${{ env.EXAMPLES_VERSION }}
57-
- name: "Build and push examples-run image"
58-
uses: docker/build-push-action@v3
59-
with:
60-
push: true
61-
file: docker/run.dockerfile
62-
build-args: |
63-
EXAMPLES_VERSION=${{ env.EXAMPLES_VERSION }}
64-
FAASM_VERSION=${{ env.FAASM_VERSION }}
65-
context: .
66-
tags: faasm.azurecr.io/examples-run:${{ env.FAASM_VERSION }}

.github/workflows/tests.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: "Checkout code"
4242
uses: actions/checkout@v4
4343
# Check if any of the submodules have been modified
44-
- uses: dorny/paths-filter@v2
44+
- uses: dorny/paths-filter@v3
4545
id: filter
4646
with:
4747
filters: |
@@ -57,7 +57,7 @@ jobs:
5757
git config --global --add safe.directory "$GITHUB_WORKSPACE"
5858
echo "cpp-commit=$(git submodule status ./cpp | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
5959
echo "py-commit=$(git submodule status ./python | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
60-
- uses: actions/cache/restore@v3.3.1
60+
- uses: actions/cache/restore@v4
6161
id: wasm-cache
6262
with:
6363
path: ./wasm
@@ -109,7 +109,7 @@ jobs:
109109
mv /usr/local/faasm/wasm ./wasm
110110
# If we are here we _always_ want to overwrite the cache
111111
- name: "Prepare WASM cache"
112-
uses: actions/cache/save@v3.3.1
112+
uses: actions/cache/save@v4
113113
if: always()
114114
with:
115115
path: ./wasm
@@ -133,7 +133,7 @@ jobs:
133133
env:
134134
CONAN_CACHE_MOUNT_SOURCE: ~/.conan
135135
FAASM_INI_FILE: ./faasm.ini
136-
FAASM_VERSION: 0.20.1
136+
FAASM_VERSION: 0.21.1
137137
FAASM_WASM_VM: ${{ matrix.faasm_wasm_vm }}
138138
steps:
139139
- uses: csegarragonz/set-compose-version-action@main
@@ -175,7 +175,7 @@ jobs:
175175
echo "cpp-commit=$(git submodule status ./cpp | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
176176
echo "py-commit=$(git submodule status ./python | cut '-d ' -f 2)" >> $GITHUB_OUTPUT
177177
- name: "Get WASM cache"
178-
uses: actions/cache/restore@v3.3.1
178+
uses: actions/cache/restore@v4
179179
id: cpp-wasm-cache
180180
with:
181181
path: ./wasm
@@ -184,9 +184,6 @@ jobs:
184184
- name: "Upload all WASM files to the cluster"
185185
run: ./bin/inv_wrapper.sh wasm.upload
186186
- name: "Run MPI kernels"
187-
# TODO: MPI kernels still not run in WAMR because there's a seg. fault
188-
# with the `exit` syscall
189-
if: "contains(env.FAASM_WASM_VM, 'wavm')"
190187
timeout-minutes: 2
191188
run: |
192189
# The global MPI kernel stopped working when enabling SIMD

FAASM_VERSION

-1
This file was deleted.

docker-compose.yml

-41
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,6 @@
11
version: "3"
22

33
services:
4-
redis:
5-
image: faasm.azurecr.io/redis:${EXAMPLES_RUN_VERSION}
6-
7-
planner:
8-
image: faasm.azurecr.io/planner:0.11.0
9-
environment:
10-
- LOG_LEVEL=info
11-
- PLANNER_PORT=8081
12-
13-
minio:
14-
image: faasm.azurecr.io/minio:${EXAMPLES_RUN_VERSION}
15-
environment:
16-
MINIO_ROOT_USER: minio
17-
MINIO_ROOT_PASSWORD: minio123
18-
volumes:
19-
- ./dev/minio/data:/data/minio
20-
healthcheck:
21-
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
22-
interval: 5s
23-
timeout: 3s
24-
retries: 3
25-
26-
run:
27-
depends_on:
28-
- redis
29-
- minio
30-
image: faasm.azurecr.io/examples-run:${EXAMPLES_RUN_VERSION}
31-
working_dir: /usr/local/code/faasm
32-
stdin_open: true
33-
tty: true
34-
volumes:
35-
- ./:/code/examples
36-
- ./dev/faasm-local/:/usr/local/faasm
37-
environment:
38-
- DEFAULT_MPI_WORLD_SIZE=4
39-
- LOG_LEVEL=info
40-
- LD_LIBRARY_PATH=/build/faasm/third-party/lib:/usr/local/lib
41-
- REDIS_QUEUE_HOST=redis
42-
- REDIS_STATE_HOST=redis
43-
- FAASM_WASM_VM=${FAASM_WASM_VM:-wavm}
44-
454
build:
465
image: faasm.azurecr.io/examples-build:${EXAMPLES_BUILD_VERSION}
476
working_dir: /code/examples

docker/run.dockerfile

-13
This file was deleted.

requirements.txt

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

tasks/cli.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
DEV_FAASM_LOCAL,
99
EXAMPLES_BUILD_IMAGE_NAME,
1010
PROJ_ROOT,
11-
get_faasm_version,
1211
get_version,
1312
)
1413

@@ -40,12 +39,7 @@ def cli(ctx, service, clean=False):
4039
run("docker rm -f {}".format(tmp_ctr_name), shell=True, check=True)
4140

4241
build_env = environ.copy()
43-
build_env.update(
44-
{
45-
"EXAMPLES_RUN_VERSION": get_faasm_version(),
46-
"EXAMPLES_BUILD_VERSION": get_version(),
47-
}
48-
)
42+
build_env.update({"EXAMPLES_BUILD_VERSION": get_version()})
4943
docker_cmd = "docker compose up -d --no-recreate {}".format(service)
5044
run(docker_cmd, shell=True, check=True, cwd=PROJ_ROOT, env=build_env)
5145

@@ -56,12 +50,7 @@ def cli(ctx, service, clean=False):
5650
@task()
5751
def stop(ctx):
5852
build_env = environ.copy()
59-
build_env.update(
60-
{
61-
"EXAMPLES_RUN_VERSION": get_faasm_version(),
62-
"EXAMPLES_BUILD_VERSION": get_version(),
63-
}
64-
)
53+
build_env.update({"EXAMPLES_BUILD_VERSION": get_version()})
6554
run(
6655
"docker compose down",
6756
shell=True,

tasks/env.py

+9-43
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from faasmtools.env import get_version as get_cpp_version
44
from os import environ
55
from os.path import dirname, abspath, join
6-
from re import search as re_search
7-
from subprocess import run
6+
from yaml import safe_load
87

98
PROJ_ROOT = dirname(dirname(abspath(__file__)))
109
EXAMPLES_IN_DOCKER_ROOT = "/code/examples"
@@ -69,55 +68,22 @@ def get_python_version():
6968

7069
def get_faasm_version():
7170
"""
72-
Get the version of the python submodule
71+
Get the version of the Faasm dependency
7372
"""
74-
ver_file = join(PROJ_ROOT, "FAASM_VERSION")
75-
76-
with open(ver_file, "r") as fh:
77-
version = fh.read()
78-
79-
version = version.strip()
80-
return version
81-
82-
83-
def get_faabric_version(old_faasm_ver, new_faasm_ver):
84-
"""
85-
Get the faabric version by `wget`-ing the FAASM version file for the tagged
86-
Faasm version
87-
"""
88-
89-
def do_get_ver(faasm_ver):
90-
tmp_file = "/tmp/faabric_version"
91-
wget_cmd = [
92-
"wget",
93-
"-O {}".format(tmp_file),
94-
"https://raw.githubusercontent.com/faasm/faasm/v{}/.env".format(
95-
faasm_ver
96-
),
97-
]
98-
wget_cmd = " ".join(wget_cmd)
99-
out = run(wget_cmd, shell=True, capture_output=True)
100-
assert out.returncode == 0
101-
102-
with open(tmp_file, "r") as fh:
103-
ver = re_search(r"planner:([0-9\.]*)", fh.read()).groups(1)[0]
104-
105-
return ver
106-
107-
return do_get_ver(old_faasm_ver), do_get_ver(new_faasm_ver)
73+
yaml_path = join(PROJ_ROOT, ".github", "workflows", "tests.yml")
74+
return safe_load(open(yaml_path, "r"))["jobs"]["run-examples-faasmctl"][
75+
"env"
76+
]["FAASM_VERSION"]
10877

10978

110-
def get_version(name="build"):
79+
def get_version():
11180
"""
11281
Get version for the examples repository
11382
11483
The version depends only on the version of the different cross-compilation
115-
toolchains we use, in this case CPP and Python, and Faasm
84+
toolchains we use, in this case CPP and Python
11685
"""
117-
if name == "build":
118-
return "{}_{}".format(get_cpp_version(), get_python_version())
119-
if name == "run":
120-
return "{}".format(get_faasm_version())
86+
return "{}_{}".format(get_cpp_version(), get_python_version())
12187

12288

12389
def in_docker():

tasks/git.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
from tasks.env import (
44
EXAMPLES_BUILD_IMAGE_NAME,
55
PROJ_ROOT,
6-
get_faabric_version,
76
get_faasm_version,
87
get_version,
98
)
109

1110
VERSIONED_FILES = {
12-
"faasm": ["FAASM_VERSION", ".github/workflows/tests.yml"],
13-
"faabric": ["docker-compose.yml", ".github/workflows/tests.yml"],
11+
"faasm": [".github/workflows/tests.yml"],
1412
"cpp": [".github/workflows/tests.yml"],
1513
"python": [".github/workflows/tests.yml"],
14+
"faasmctl": ["requirements.txt"],
1615
}
1716

1817

@@ -41,9 +40,9 @@ def tag(ctx, force=False):
4140
@task
4241
def bump(ctx, submodule, ver=None):
4342
"""
44-
Bump a submodule's dependency: `faasm`, `cpp`, or `python`
43+
Bump a submodule's dependency: `faasm`, `cpp`, `python`, or `faasmctl`
4544
"""
46-
allowed_submodules = ["faasm", "cpp", "python"]
45+
allowed_submodules = ["faasm", "cpp", "python", "faasmctl"]
4746
if submodule not in allowed_submodules:
4847
print("Unrecognised submodule: {}".format(allowed_submodules))
4948
print("Submodule must be one in: {}".format(allowed_submodules))
@@ -61,12 +60,6 @@ def bump(ctx, submodule, ver=None):
6160
sed_cmd = "sed -i 's/{}/{}/g' {}".format(old_ver, new_ver, f)
6261
run(sed_cmd, shell=True, check=True)
6362

64-
# Also update the planner version accordingly
65-
old_fabric_ver, new_faabric_ver = get_faabric_version(old_ver, new_ver)
66-
for f in VERSIONED_FILES["faabric"]:
67-
sed_cmd = "sed -i 's/{}/{}/g' {}".format(old_ver, new_ver, f)
68-
run(sed_cmd, shell=True, check=True)
69-
7063
else:
7164
new_ver = get_version("build")
7265
grep_cmd = "grep '{}' .github/workflows/tests.yml".format(
@@ -83,3 +76,8 @@ def bump(ctx, submodule, ver=None):
8376
for f in VERSIONED_FILES[submodule]:
8477
sed_cmd = "sed -i 's/{}/{}/g' {}".format(old_ver, new_ver, f)
8578
run(sed_cmd, shell=True, check=True)
79+
80+
81+
@task
82+
def foo(ctx):
83+
print(get_faasm_version())

0 commit comments

Comments
 (0)