Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discussion(lang): How to support multi-target #403

Closed
Tracked by #541
gaocegege opened this issue Jun 16, 2022 · 4 comments · Fixed by #497
Closed
Tracked by #541

discussion(lang): How to support multi-target #403

gaocegege opened this issue Jun 16, 2022 · 4 comments · Fixed by #497

Comments

@gaocegege
Copy link
Member

gaocegege commented Jun 16, 2022

Machine learning does not only include training. You may also need to process data/serving.

You as the user may want to build a separate image for a specific purpose. Thus we may need to support:

version = "2.9.1"

def dev_env(version):
    # Use nvidia/cuda:devel image
    base(runtime="devel")
    install.python_packages(name=[
        "tensorflow=="+version,
        "tensorboard"
    ])
    config.jupyter(password="", port=8888)
    shell("zsh")
    config.vscode(extension=[
        "ms-python.python"
    ])

def serving_env(version):
    base(runtime="runtime")
    install.python_packages(name=[
        "tensorflow=="+version,
    ])

def build():
    cuda(version="11.6", cudnn="8")
    dev_env(version)

def serve():
    serving_env(version)
    cuda(version="11.6", cudnn="8")
    entrypoint("python server.py")

You can run envd build --func build or envd build --func serve to build dev/serving images.

@gaocegege
Copy link
Member Author

@popfido

I'd appreciate it if you could give some feedback as the end user.

@popfido
Copy link
Member

popfido commented Jun 17, 2022

The design looks like a similar describe structure in Makefile but in a more human readable way. Cool for me!

@VoVAllen VoVAllen self-assigned this Jun 27, 2022
@VoVAllen
Copy link
Member

Bazel: https://docs.bazel.build/versions/main/tutorial/cpp.html#specify-multiple-build-targets

cc_library(
    name = "hello-greet",
    srcs = ["hello-greet.cc"],
    hdrs = ["hello-greet.h"],
)

cc_binary(
    name = "hello-world",
    srcs = ["hello-world.cc"],
    deps = [
        ":hello-greet",
    ],
)

CLI

bazel build //main:hello-world

@VoVAllen
Copy link
Member

Bramble

load("github.com/maxmcd/bramble/tests/simple/simple")
load(nix_seed="github.com/maxmcd/bramble/lib/nix-seed")
load("github.com/maxmcd/bramble/lib")
load("github.com/maxmcd/bramble/tests/nested-sources/another-folder/nested")


def print_simple():
    return run(simple.simple(), "simple", hidden_paths=["/"])


def bash():
    return run(nix_seed.stdenv(), "bash", read_only_paths=["./"])


def all():
    return [
        lib.busybox(),
        lib.git_fetcher(),
        nested.nested(),
        simple.simple(),
    ]

CLI

bramble build github.com/maxmcd/bramble:all github.com/maxmcd/bramble:bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants