Skip to content

Commit

Permalink
Merge e5c646f into 34c8b10
Browse files Browse the repository at this point in the history
  • Loading branch information
rleonid committed Oct 31, 2016
2 parents 34c8b10 + e5c646f commit 79a0c4d
Show file tree
Hide file tree
Showing 166 changed files with 1,782 additions and 1,106 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
_build
_test_build
_lite_build
_covered_test_build
_doc_build
report_dir/
*.native
*.byte
*.install
bisect*.out
oml.docdir
oml.odocl
Expand Down
7 changes: 5 additions & 2 deletions .merlin
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
PKG kaputt
S ./src/lib/**
PKG lacaml lbfgs ocephes
S src/**
S src-full/**
S test
S scripts
B _build/**
B _driver/**
PKG lacaml lbfgs ocephes
16 changes: 14 additions & 2 deletions .ocamlinit
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#directory "_lite_build/src/lib" ;;
#load_rec "oml_lite.cma";;
(* Need to list all of the sub directories so that Utop
knows where to look. *)

#directory "_build/src";;
#load_rec "oml.cma";;
print_endline "Loaded Oml" ;;

#require "ocephes";;
#require "lacaml";;
#require "lbfgs";;

#directory "_build/src-full";;
#load_rec "oml_full.cma";;
print_endline "Loaded Oml Full" ;;
File renamed without changes.
120 changes: 42 additions & 78 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,98 +1,65 @@
TEST_BUILD_DIR="_test_build"
COVERED_TEST_BUILD_DIR="_covered_test_build"
DOC_BUILD_DIR="_doc_build"
PACKAGES_INSTALL=ocephes lacaml lbfgs
PACKAGES_INSTALL_TEST=kaputt bisect_ppx dsfo

TEST_BUILD_DIR=_test_build
LITE_BUILD_DIR=_lite_build
PACKAGES=lacaml lbfgs ocephes
PACKAGES_TEST=$(PACKAGES) kaputt dsfo
PACKAGES_COVERED:=$(PACKAGES_TEST) bisect_ppx
PACKAGES_INSTALL=cppo $(PACKAGES)
PACKAGES_INSTALL_TEST=cppo $(PACKAGES_COVERED)
CPPO_TAG:=-plugin-tag 'package(cppo_ocamlbuild)'

SOURCE_DIRS=/util /unc /stats /cls /rgr /uns
INSTALL_EXTS=a o cma cmi cmo cmt cmx cmxa cmxs

.PHONY: all clean test build install uninstall setup default doc omltest.native oml.cmxa oml_lite.cmxa lite
.PHONY: all clean test build full setup doc

default: FORCE
@echo "available targets:"
@echo " build compiles Oml"
@echo " lite compiles Oml_lite"
@echo " tests runs unit tests"
@echo " doc generates ocamldoc documentations"
@echo " clean deletes all produced files"
@echo " setup opam install Oml dependencies"
@echo " setup-test opam install Oml and testing dependencies"
@echo " install copies executable and library files"
@echo " install-lite copies executable and library files"
@echo " covered_test runs unit tests with coverage"
@echo " report generate Bisect_ppx coverage report"

@echo " build compiles"
@echo " build_lite compiles without C dependencies."
@echo " test runs unit tests"
@echo " test_lite test without C dependencies"
@echo " covered_test runs unit tests with coverage"
@echo " covered_test_lite runs unit tests without C dependencies with coverage"
@echo " setup opam install packages necessary for full build"
@echo " setup_test opam install packages necessary for testing"
@echo " doc generates ocamldoc documentations"
@echo " clean deletes all produced files"
@echo " report generate Bisect_ppx coverage report"

# This should be called something else.
setup:
opam install $(PACKAGES_INSTALL)

setup-test:
setup_test:
opam pin add dsfo git://github.com/rleonid/dsfo
opam install $(PACKAGES_INSTALL_TEST)

#### Building

oml.cmxa:
ocamlbuild $(CPPO_TAG) -use-ocamlfind $(foreach package, $(PACKAGES),-package $(package)) -I src/lib oml.cma oml.cmxa oml.cmxs
build:
ocaml pkg/pkg.ml build

lite:
mv src/lib/_tags src/lib/_tags_orig && \
cp src/lib/_lite_tags src/lib/_tags && \
ocamlbuild -build-dir $(LITE_BUILD_DIR) $(CPPO_TAG) -tag 'cppo_D(OML_LITE)' -use-ocamlfind -I src/lib oml_lite.cma oml_lite.cmxa oml_lite.cmxs && \
mv src/lib/_tags_orig src/lib/_tags || \
mv src/lib/_tags_orig src/lib/_tags
build_lite:
ocaml pkg/pkg.ml build --with-lacaml false --with-lbfgs false --with-ocephes false

build: oml.cmxa

clean:
ocamlbuild -clean
ocamlbuild -build-dir $(TEST_BUILD_DIR) -clean
ocamlbuild -build-dir $(LITE_BUILD_DIR) -clean
ocaml pkg/pkg.ml clean
ocaml pkg/pkg.ml clean --build-dir $(TEST_BUILD_DIR)
ocaml pkg/pkg.ml clean --build-dir $(COVERED_TEST_BUILD_DIR)
ocaml pkg/pkg.ml clean --build-dir $(DOC_BUILD_DIR)

#### Testing

omltest.native:
ocamlbuild -build-dir $(TEST_BUILD_DIR) \
$(CPPO_TAG) \
-use-ocamlfind $(foreach package, $(PACKAGES_TEST),-package $(package)) \
-I src/lib $(foreach sd, $(SOURCE_DIRS), -I src/lib$(sd)) -I src/test omltest.native

test: omltest.native
time ./omltest.native ${TEST}

covered_test.native:
ocamlbuild -build-dir $(TEST_BUILD_DIR) \
$(CPPO_TAG) \
-use-ocamlfind $(foreach package, $(PACKAGES_COVERED),-package $(package)) \
-I src/lib $(foreach sd, $(SOURCE_DIRS), -I src/lib$(sd)) -I src/test omltest.native

covered_test: covered_test.native
time ./omltest.native ${TEST}
test:
ocaml pkg/pkg.ml build --build-dir $(TEST_BUILD_DIR) -n omltest && \
time ocaml pkg/pkg.ml test --build-dir $(TEST_BUILD_DIR)

test_environment:
ocamlbuild -build-dir $(TEST_BUILD_DIR) \
-use-ocamlfind $(foreach package, $(PACKAGES_COVERED),-package $(package)) \
-I src/lib -I src/test oml.cma omltest.native
test_lite:
ocaml pkg/pkg.ml build --build-dir $(TEST_BUILD_DIR) --with-lacaml false --with-lbfgs false --with-ocephes false -n omltest && \
time ocaml pkg/pkg.ml test --build-dir $(TEST_BUILD_DIR)

#### Installing
covered_test:
ocaml pkg/pkg.ml build --build-dir $(COVERED_TEST_BUILD_DIR) --with-coverage true -n omltest && \
time ocaml pkg/pkg.ml test --build-dir $(COVERED_TEST_BUILD_DIR)

install:
cd pkg/full && ocamlfind install oml META $(foreach ext, $(INSTALL_EXTS), ../../_build/src/lib/oml.$(ext))

uninstall:
ocamlfind remove oml

install-lite:
cd pkg/lite && ocamlfind install oml-lite META $(foreach ext, $(INSTALL_EXTS), ../../${LITE_BUILD_DIR}/src/lib/oml_lite.$(ext))

uninstall-lite:
ocamlfind remove oml-lite
covered_test_lite:
ocaml pkg/pkg.ml build --build-dir $(COVERED_TEST_BUILD_DIR) --with-lacaml false --with-lbfgs false --with-ocephes false --with-coverage true -n omltest && \
time ocaml pkg/pkg.ml test --build-dir $(COVERED_TEST_BUILD_DIR)

#### Test Coverage

Expand All @@ -103,20 +70,17 @@ report_dir:
# (ie. the *.ml has the *.mlt inside of it with our label), we get proper
# alignment of the html!
report: report_dir
cd $(TEST_BUILD_DIR) && \
cd $(COVERED_TEST_BUILD_DIR) && \
bisect-ppx-report -html ../report_dir ../$(shell ls -t bisect*.out | head -1) && \
cd -

clean_reports:
rm -rf report_dir bisect*.out


#### Documentation

oml.odocl:
cp src/lib/oml.mlpack oml.odocl

doc: oml.odocl
ocamlbuild -use-ocamlfind $(foreach package, $(PACKAGES),-package $(package)) -I src/lib oml.docdir/index.html
doc:
ocamlbuild -classic-display -use-ocamlfind -plugin-tag 'package(str)' -no-links -build-dir $(DOC_BUILD_DIR) -docflags '-colorize-code,-charset,utf-8' doc/api.docdir/index.html

# topkg doc --build-dir $(DOC_BUILD_DIR)
FORCE:
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ The API is available [online](http://hammerlab.github.io/oml/index.html).
### Goals

1. Perform simple and sophisticated mathematical and statistical analysis
inside of (mostly) OCaml. Please see [Oml_lite](#oml_lite) for details.
inside of (mostly) OCaml. Please see [Oml_full](#oml_full) section
for details.
2. Have a descriptive, simple, and typed approach to those algorithms.
- _descriptive_: what a function does should be easy to understand from
the type and name.
Expand All @@ -27,37 +28,38 @@ The API is available [online](http://hammerlab.github.io/oml/index.html).
### Building

- `make setup` will `opam install` the necessary packages for Oml.
[Oml_lite](#oml_lite) has no dependencies.
- `make` will compile source.
- `make test
[Oml_full](#oml_full) has no dependencies.
- `make build` will compile source.
- `make test` for tests.
- We use [Kaputt](http://kaputt.x9c.fr/) as the testing framework. Tests
are found in `*.mlt` files and are joined with their respective source
files only when we build a test target.
files only when building a test target.
- `make TEST={ModuleName} test` will run the test in `ModuleName`,
ex `make TEST=Descriptive test`
- `make setup-test` will install packages necessary for testing.
- `make setup_test` will install packages necessary for testing.
- `make covered_test` for [Bisect_ppx](https://github.com/rleonid/bisect_ppx)
instrumented test coverage.

### <a name="oml_lite">Oml_lite</a>
### <a name="oml_full">Oml_full</a>

Oml_lite is a subset of Oml that excludes any code with a `C` or `Fortran`
dependency.
Oml_full is a superset of Oml that includes `C` and/or `Fortran` dependencies.
It is generally more useful and incorporates `Oml` in a typed equivalent way.
The goal is to provide a flexible end-user target for those who don't need
`C` dependent functionality.

### Dependencies

`make setup` will `opam install` these:
For the "full" Oml package `make setup` will `opam install` these:

- [Lacaml](https://github.com/mmottl/lacaml) for BLAS/LAPACK bindings.
- [LBFGS](https://github.com/Chris00/L-BFGS-ocaml) for bindings to LBFGS
optimization routines.
- [ocephes](https://github.com/rleonid/ocephes) for special functions.

And for testing:

- [Kaputt](http://kaputt.x9c.fr/) for testing.
- [Bisect_ppx](https://github.com/rleonid/bisect_ppx) for code coverage.
- See [Bisect](http://bisect.x9c.fr/) for initial implementation
- and [Ocveralls](https://github.com/sagotch/ocveralls/) for pushing to
[Coveralls](https://coveralls.io/).

### Contributing

Expand Down
17 changes: 15 additions & 2 deletions _tags
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@
# 48 : implicit elimination of optional arguments (ex. ?n, ?c, ?ofsx, ?incx)
# 50 : ambiguous documentation comment.
# I'd like to get rid of 42,44 and 50
true: annot, bin_annot, principal, warn(A-42-44-48-50), warn_error(A-42-44-48-50)
true: safe_string, annot, bin_annot, principal, warn(A-42-44-48-50)

# warn_error(A-42-44-48-50)

<src> : include
<src/*> : include
<src-full> : include
<src-full/*> : include
<src-full/**> : package(lacaml), package(ocephes), package(lbfgs)
<src/**/*.mlj> : package(kaputt)
<src-full/**/*.mlj> : package(kaputt)
<test/**> : package(kaputt)

"_build": -traverse
"_test_build": -traverse
"_lite_build": -traverse
"_covered_test_build": -traverse
"_doc_build": -traverse
2 changes: 2 additions & 0 deletions doc/api.odocl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Oml
Oml_full

0 comments on commit 79a0c4d

Please sign in to comment.