You can either install zelus from sources or with docker
- Requirements
- Mandatory:
- Ocaml (>= 4.10.0)
- Menhir
- Optional:
- SundialsML
- Lablgtk2
- glMLite
- Mandatory:
Installing requirements on a fresh ubuntu 18.10 machine (with opam):
# system requirements
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y build-essential sudo m4 libgtk2.0-dev libsundials-dev curl
# install opam
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
source ~/.bashrc
# ocaml requirements
opam init -a
opam switch 4.08.0
eval $(opam env)
opam update
opam upgrade -y
eval $(opam env)
opam install -y ocamlfind menhir sundialsml lablgtk
evam $(opam env)
# installation
./configure
make
make install
make docker_build
make docker_run
Debugging the compiler:
-
Build the compiler with debugging symbols: make clean debug
-
Start emacs, then M-x camldebug Run camldebug on file: compiler/zeluc.byte Caml debugger to run: ocamldebug
-
In the Ocaml debugger, copy-and-paste the commands listed in debug.txt, changing the last to include any additional flags and the path to the file to compile (relative to the compiler/ subdirectory).
-
Debug! (e.g.: run, step, break, etc.)
Profiling generated executables:
-
Compile the library using ocamlcp: cd lib; make clean OCAMLC="ocamlcp -p a" byte
-
Compile the output of zeluc using ocamlcp, e.g., cd examples/bouncingball; make clean OCAMLC="ocamlcp -p a" byte
-
Run the program (using -maxt to terminate normally): rm -f ocamlprof.dump # do not accumulate ./ball.byte -sundialsI -maxt 15
-
Examine the files: ocamlprof ball.ml ocamlprof ball_main.ml ocamlprof ../../lib/zlsolve.ml ocamlprof ../../lib/solvers.ml ocamlprof ../../lib/solvers/solversundials.ml ocamlprof ../../lib/solvers/illinois.ml
Time profiling generated executables:
-
Compile the library with ocamlopt -p: cd lib; make clean OCAMLOPTFLAGS=-p opt
-
Compile the output of zeluc using ocamlopt -p, e.g., cd examples/bouncingball; make clean OCAMLOPTFLAGS=-p ball.opt
-
Run the program and examine the results: ./ball.opt -sundialsI -maxt 15 gprof ball.opt