-
Notifications
You must be signed in to change notification settings - Fork 12
chore: support AL2 development using build container #522
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
Open
kerrijoe-aws
wants to merge
1
commit into
main
Choose a base branch
from
kerrijoe/lakew
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| FROM ubuntu:latest | ||
|
|
||
| RUN apt-get update && apt-get install -y curl git && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN curl https://elan.lean-lang.org/elan-init.sh -sSf | sh -s -- -y --default-toolchain none | ||
| ENV PATH="/root/.elan/bin:${PATH}" | ||
|
|
||
| WORKDIR /workspace |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # KLR build container | ||
|
|
||
| Amazon Linux 2 (AL2) currently uses an old GLIBC version that is not supported by our Lean toolchain. | ||
| We provide a Docker image that can be used for development on AL2 and other unsupported platforms. | ||
|
|
||
| ## Usage | ||
|
|
||
| The project root contains a simple wrapper script, `lakew`. Use `lakew` in place of `lake`: | ||
|
|
||
| ``` | ||
| $ ./lakew build | ||
| <...> | ||
| Build completed successfully (575 jobs). | ||
| $ ./lakew exe klr | ||
| klr [0.0.12] | ||
| KLR is an IR for NKI and other tensor-like languages in Lean. | ||
|
|
||
| USAGE: | ||
| klr [SUBCOMMAND] [FLAGS] | ||
|
|
||
| FLAGS: | ||
| -h, --help Prints this message. | ||
| --version Prints the version. | ||
|
|
||
| SUBCOMMANDS: | ||
| compile Compile a NKI kernel | ||
| gather Gather Python sources into an AST file | ||
| info Display information about a KLR file | ||
| trace Trace Python to KLR | ||
| list List builtin functions and constants | ||
| ``` |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/bash | ||
| # build_container_exec: run a command inside build container | ||
|
|
||
| cd "$(dirname "$0")/.." || exit 1 | ||
|
|
||
| if ! docker image inspect klr-build &>/dev/null; then | ||
| echo "Error: klr-build image not found." | ||
| read -p "Build it now? (y/n) " -n 1 -r | ||
| echo | ||
| if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
| docker build -t klr-build build_container/ || exit 1 | ||
| else | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| # Mount project directory at /workspace so generated sources end up in the right place. | ||
| # Override ELAN_HOME and mount it as a volume so we cache Lean toolchains in between invocations. | ||
| docker run -it --rm -v "$(pwd):/workspace" -v /tmp/klr-elan:/elan -e ELAN_HOME=/elan -w /workspace klr-build "$@" |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
| # lakew: lake wrapper | ||
| # runs lake inside build container | ||
| # see build_container/README.md for additional details | ||
|
|
||
| cd "$(dirname "$0")" || exit 1 | ||
|
|
||
| ./build_container/build_container_exec lake "$@" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this in
binwith the other tools?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, maybe combine the two scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./lakewin place oflake. I stole this idea from Gradle, which often puts Gradle wrapper scripts at./gradlew. But if you two agree it should be inbin, then I'll do that and then set up a shell alias on my end.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, makes sense.