Skip to content

Commit 9cb825a

Browse files
committed
Moving to faasmtools
1 parent ae670a5 commit 9cb825a

File tree

11 files changed

+84
-25
lines changed

11 files changed

+84
-25
lines changed

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.1

bin/crossenv_setup.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ BUILD_PYTHON_BIN=/usr/local/faasm/python3.8/bin
1111
BUILD_PYTHON=${BUILD_PYTHON_BIN}/python3.8
1212
BUILD_PIP=${BUILD_PYTHON_BIN}/pip3.8
1313

14-
FAASM_DIR=/usr/local/code/faasm
15-
FAASMCLI=${FAASM_DIR}/faasmcli
16-
1714
# Install the build machine python dependencies
1815
CROSSENV_SRC_DIR=${PROJ_ROOT}/third-party/crossenv
1916
echo "Installing crossenv from ${CROSSENV_SRC_DIR}"
@@ -27,11 +24,6 @@ ${BUILD_PIP} install cython
2724
echo "Installing invoke"
2825
${BUILD_PIP} install invoke
2926

30-
echo "Installing Faasmcli"
31-
pushd ${FAASMCLI} >> /dev/null
32-
${BUILD_PIP} install .
33-
popd >> /dev/null
34-
3527
# Run the set-up script
3628
pushd ${PROJ_ROOT} >> /dev/null
3729
${BUILD_PYTHON} bin/crossenv_setup.py

docker/cpython.dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM faasm/sysroot:0.0.7
2+
3+
RUN apt install -y \
4+
libssl-dev
5+
6+
WORKDIR cpython
7+
COPY requirements.txt .
8+
RUN pip3 install -r requirements.txt
9+
10+
11+
COPY . .
12+
13+
# Install build Python
14+
RUN ./bin/install_build_python.sh
15+
16+
# Install crossenv
17+
RUN ./bin/crossenv_setup.sh
18+
19+
# Build mxnet
20+
RUN inv mxnet
21+
22+
# Build cpython
23+
RUN inv cpython
24+
25+
# Cross-compile packages
26+
RUN . ./cross_venv/bin/activate && inv libs.install
27+
RUN . ./cross_venv/bin/activate && inv libs.install --experimental

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
black
2+
invoke
3+
pyyaml

tasks/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
from invoke import Collection
22

33
from . import (
4+
container,
45
cpython,
56
libs,
67
mxnet,
78
ffi,
89
)
910

1011
ns = Collection(
12+
container,
1113
cpython,
1214
libs,
1315
mxnet,

tasks/container.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from invoke import task
2+
from os.path import join
3+
4+
from faasmtools.docker import (
5+
build_container,
6+
push_container,
7+
)
8+
9+
from tasks.env import (
10+
PROJ_ROOT,
11+
get_version,
12+
)
13+
14+
CONTAINER_IMAGE = "faasm/cpython"
15+
DOCKERFILE = join(PROJ_ROOT, "docker", "cpython.dockerfile")
16+
17+
18+
@task(default=True)
19+
def build(ctx, nocache=False, push=False):
20+
"""
21+
Build current version of the cpython container
22+
"""
23+
tag_name = "{}:{}".format(CONTAINER_IMAGE, get_version())
24+
25+
build_container(
26+
tag_name, DOCKERFILE, PROJ_ROOT, nocache=nocache, push=push
27+
)
28+
29+
30+
@task
31+
def push(ctx):
32+
"""
33+
Push the current version of the cpython container
34+
"""
35+
tag_name = "{}:{}".format(CONTAINER_IMAGE, get_version())
36+
push_container(tag_name)

tasks/cpython.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,7 @@
55
from os.path import join, exists
66
from subprocess import run
77

8-
from faasmcli.util.toolchain import (
9-
WASM_CC,
10-
WASM_BUILD,
11-
WASM_HOST,
12-
BASE_CONFIG_CMD,
13-
BASE_CONFIG_FLAGS,
14-
WASM_CFLAGS_SHARED,
15-
WASM_LDFLAGS_SHARED,
16-
build_config_cmd,
17-
)
8+
from faasmtools.build import build_config_cmd
189

1910
from invoke import task
2011

tasks/env.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,12 @@
77
CROSSENV_DIR = join(PROJ_ROOT, "cross_venv", "cross")
88

99
USABLE_CPUS = str(int(cpu_count()) - 1)
10+
VERSION_FILE = join(PROJ_ROOT, "VERSION")
11+
12+
13+
def get_version():
14+
with open(VERSION_FILE) as fh:
15+
version = fh.read().strip()
16+
17+
return version
18+

tasks/ffi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from os.path import join, exists
22
from subprocess import run
33

4-
from faasmcli.util.toolchain import (
4+
from faasmtools.build import (
55
build_config_cmd,
66
run_autotools,
77
WASM_SYSROOT,

tasks/libs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import os
22

33
from copy import copy
4-
from faasmcli.util.toolchain import WASM_LIB_INSTALL
5-
from faasmcli.util.env import FAASM_TOOLCHAIN_FILE
4+
from faasmtools.build import WASM_LIB_INSTALL, CMAKE_TOOLCHAIN_FILE
65
from os.path import join
76
from subprocess import run
87
from tasks.env import USABLE_CPUS, THIRD_PARTY_DIR, CROSSENV_DIR
@@ -22,7 +21,7 @@
2221
"horovod": {
2322
"env": {
2423
"MAKEFLAGS": "-j{}".format(USABLE_CPUS),
25-
"HOROVOD_TOOLCHAIN_FILE": FAASM_TOOLCHAIN_FILE,
24+
"HOROVOD_TOOLCHAIN_FILE": CMAKE_TOOLCHAIN_FILE,
2625
"HOROVOD_WITH_MXNET": "1",
2726
"HOROVOD_WITH_MPI": "1",
2827
"HOROVOD_WITH_TENSORFLOW": "0",

0 commit comments

Comments
 (0)