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

Use flambda compiler optimization #928

Merged
merged 24 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
52c7671
Update README.md
sxprz Nov 17, 2022
40b919b
Update README.md
sxprz Nov 17, 2022
acfcba0
Update make.sh to also install ocaml with flambda
mrstanb Nov 10, 2022
cb20ac4
Update make.sh for the right flambda switch + update goblint.opam.locked
mrstanb Nov 14, 2022
74c4df2
Remove eval from opam_setup_flambda
mrstanb Nov 20, 2022
bb6fcf1
Update README with flambda installation info
mrstanb Nov 24, 2022
1f9674d
Remove v2.9 for dune from goblint.opam
mrstanb Nov 26, 2022
4b81638
add flambda flags
montrie Nov 30, 2022
fcda025
Add the flambda compiler version to unlocked.yml
mrstanb Dec 4, 2022
5f3f798
Add ocaml-option-flambda to 4.14.0+options compiler in unlocked.yml
nathanschmidt Dec 5, 2022
cfc45e4
Update flambda flags to just -O3
nathanschmidt Dec 11, 2022
cf0d5c4
Fix conflict with upstream README
mrstanb Dec 20, 2022
00ac11c
Merge branch 'master' into use-flambda-compiler
mrstanb Dec 20, 2022
4671b70
Added -O3 flag to dev env
nathanschmidt Dec 21, 2022
fb0b72e
Removed -O3 from dev env, made flambda default, added make-base for s…
nathanschmidt Dec 29, 2022
a299dfd
Add -unused-functor-parameter warning in src/dune
mrstanb Jan 10, 2023
3e222e0
Update README.md
mrstanb Jan 10, 2023
61ad751
Fix autoformatted README
mrstanb Jan 10, 2023
7013805
Remove setup-base and use only flambda with -locked
mrstanb Jan 10, 2023
3c75d3e
Merge branch 'use-flambda-compiler' of github.com:adelavais/analyzer …
mrstanb Jan 10, 2023
0412216
Fix whitespace in README
mrstanb Jan 10, 2023
4f9acc1
Fix flambda conflict in locked workflows
sim642 Jan 14, 2023
b7e6794
Fix flambda compiler name for setup-ocaml
sim642 Jan 14, 2023
331ff8c
Use flambda option in gobview
sim642 Jan 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/unlocked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- ubuntu-latest
- macos-latest
ocaml-compiler:
- 4.14.0+options,ocaml-option-flambda
- 4.14.x
- 4.13.x
- 4.12.x
Expand Down
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Goblint

mrstanb marked this conversation as resolved.
Show resolved Hide resolved
[![locked workflow status](https://github.com/goblint/analyzer/actions/workflows/locked.yml/badge.svg)](https://github.com/goblint/analyzer/actions/workflows/locked.yml)
[![unlocked workflow status](https://github.com/goblint/analyzer/actions/workflows/unlocked.yml/badge.svg)](https://github.com/goblint/analyzer/actions/workflows/unlocked.yml)
[![docker workflow status](https://github.com/goblint/analyzer/actions/workflows/docker.yml/badge.svg)](https://github.com/goblint/analyzer/actions/workflows/docker.yml)
Expand All @@ -8,45 +9,57 @@
Documentation can be browsed on [Read the Docs](https://goblint.readthedocs.io/en/latest/) or [GitHub](./docs/).

## Installing

Both for using an up-to-date version of Goblint or developing it, the best way is to install from source by cloning this repository.

### Linux

1. Install [opam](https://opam.ocaml.org/doc/Install.html).
2. Make sure the following are installed: `git patch m4 autoconf libgmp-dev libmpfr-dev pkg-config`.
2. Make sure the following packages are installed: `git` `patch` `m4` `autoconf` `libgmp-dev` `libmpfr-dev` `pkg-config`.
3. Run `make setup` to install OCaml and dependencies via opam.
1. In case Goblint needs to be compiled with `flambda` optimizations, then run `make setup-flambda` instead
mrstanb marked this conversation as resolved.
Show resolved Hide resolved
4. Run `make` to build Goblint itself.
5. Run `make install` to install Goblint into the opam switch for usage via switch's `PATH`.

### MacOS

1. Install GCC with `brew install gcc` (first run `xcode-select --install` if you don't want to build it from source). Goblint requires GCC while macOS's default `cpp` is Clang, which will not work.
2. ONLY for M1 (ARM64) processor: homebrew changed its install location from `/usr/local/` to `/opt/homebrew/`. For packages to find their dependecies execute `sudo ln -s /opt/homebrew/{include,lib} /usr/local/`.
3. Continue using Linux instructions (the formulae in brew for `patch libgmp-dev libmpfr-dev` are `gpatch gmp mpfr`, respectively).

### Windows

1. Install [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10). Goblint is not compatible with WSL1.
2. Continue using Linux instructions in WSL.

### Other
* **[opam](https://opam.ocaml.org/packages/goblint/)**. Install [opam](https://opam.ocaml.org/doc/Install.html) and run `opam install goblint`.
* **[devcontainer](./.devcontainer/).** Select "Reopen in Container" in VS Code and continue with `make` using Linux instructions in devcontainer.
* **[Docker (GitHub Container Registry)](https://github.com/goblint/analyzer/pkgs/container/analyzer)**. Run `docker pull ghcr.io/goblint/analyzer:latest` (or `:nightly`).
* **Docker (repository).** Clone and run `docker build -t goblint .`.
* **Vagrant.** Clone and run `vagrant up && vagrant ssh`.

- **[opam](https://opam.ocaml.org/packages/goblint/)**. Install [opam](https://opam.ocaml.org/doc/Install.html) and run `opam install goblint`.
- **[devcontainer](./.devcontainer/).** Select "Reopen in Container" in VS Code and continue with `make` using Linux instructions in devcontainer.
- **[Docker (GitHub Container Registry)](https://github.com/goblint/analyzer/pkgs/container/analyzer)**. Run `docker pull ghcr.io/goblint/analyzer:latest` (or `:nightly`).
- **Docker (repository).** Clone and run `docker build -t goblint .`.
- **Vagrant.** Clone and run `vagrant up && vagrant ssh`.
mrstanb marked this conversation as resolved.
Show resolved Hide resolved

## Running

To confirm that building worked, you can try running Goblint as follows:

```
./goblint tests/regression/04-mutex/01-simple_rc.c
```

To confirm that installation into the opam switch worked, you can try running Goblint as follows:

```
goblint tests/regression/04-mutex/01-simple_rc.c
```

To confirm that the Docker container worked, you can try running Goblint as follows:

```
docker run -it --rm -v $(pwd):/data goblint /data/tests/regression/04-mutex/01-simple_rc.c
```

If pulled from GitHub Container Registry, use the container name `ghcr.io/goblint/analyzer:latest` (or `:nightly`) instead.

For further information, see [documentation](https://goblint.readthedocs.io/en/latest/user-guide/running/).
4 changes: 2 additions & 2 deletions goblint.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ depends: [
"mlgmpidl" {= "1.2.14"}
"num" {= "1.4"}
"ocaml" {= "4.14.0"}
"ocaml-base-compiler" {= "4.14.0"}
"ocaml-variants" {= "4.14.0+options"}
"ocaml-compiler-libs" {= "v0.12.4"}
"ocaml-config" {= "2"}
"ocaml-options-vanilla" {= "1"}
"ocaml-option-flambda" {= "1"}
sim642 marked this conversation as resolved.
Show resolved Hide resolved
"ocaml-syntax-shims" {= "1.0.0"}
"ocamlbuild" {= "0.14.1"}
"ocamlfind" {= "1.9.3"}
Expand Down
14 changes: 14 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ opam_setup() {
opam switch -y create . --deps-only ocaml-base-compiler.4.14.0 --locked
}

opam_setup_flambda() {
set -x
opam init -y -a --bare $SANDBOXING # sandboxing is disabled in travis and docker
opam update
# Note: the `--update-invariant` option is needed for replacement of the previous ocaml compiler switch invariant of Goblint
opam switch -y create . --deps-only ocaml-variants.4.14.0+options ocaml-option-flambda --locked --update-invariant
}

rule() {
case $1 in
# new rules using dune
Expand Down Expand Up @@ -77,6 +85,12 @@ rule() {
echo "For running the regression tests you also need: ruby, gem, curl"
echo "For reference see ./Dockerfile or ./scripts/travis-ci.sh"
opam_setup
;; setup-flambda)
echo "Make sure you have the following installed: opam >= 2.0.0, git, patch, m4, autoconf, libgmp-dev, libmpfr-dev, pkg-config"
echo "For the --html output you also need: javac, ant, dot (graphviz)"
echo "For running the regression tests you also need: ruby, gem, curl"
echo "For reference see ./Dockerfile or ./scripts/travis-ci.sh"
opam_setup_flambda
;; dev)
eval $(opam env)
echo "Installing opam packages for development..."
Expand Down
5 changes: 5 additions & 0 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
)

(env
(release
(flags (:standard -warn-error -A -w -unused-var-strict -w +9)) ; https://dune.readthedocs.io/en/stable/faq.html#how-to-make-warnings-non-fatal
mrstanb marked this conversation as resolved.
Show resolved Hide resolved
(ocamlopt_flags
(:standard -O3))
)
(dev
(flags (:standard -warn-error -A -w -unused-var-strict -w +9)) ; https://dune.readthedocs.io/en/stable/faq.html#how-to-make-warnings-non-fatal
)
Expand Down