Skip to content

Commit

Permalink
ADE Generator Implementation (#15) (#16)
Browse files Browse the repository at this point in the history
* ADE Generator Implementation (#15)

* remove doc and investigate opcode generation

* move travel implementations down to ade

* apply grad properly

* fix significant coordinate precision lost

* prime for grader-functor decoupling

* prime functor to avoid all shaped_one/shaped_zero calls

* decouple functor and grader

* remove paint from pathfinder

* refactor pathfinder and visit gradient path in order

* move log out of ade and other refactoring

* rename namespace for err/log and age

* age refactor

* beautify iOperation

* initial implementation of ade api generator

* generate llo using age

* simplify llo extension of ade

* simplify opmap

* improve generator as python scripts

* add age tests

* genrule generated files

* update llo regression

* add back llo tests

* move out generated content and add tests

* cleanup

* update comments in ade

* add comments for bwd and cleanup

* update docs
  • Loading branch information
raggledodo committed Nov 17, 2018
1 parent 98deda7 commit 06da23c
Show file tree
Hide file tree
Showing 564 changed files with 12,369 additions and 28,193 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
script:
- git checkout ${TRAVIS_BRANCH}
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- docker build -t $DOCKER_USERNAME/tenncor-test:travis-$(git rev-parse --short HEAD) .
- docker build -t $DOCKER_USERNAME/tenncor-test:travis-latest .
- docker images
- docker push $DOCKER_USERNAME/tenncor-test:travis-$(git rev-parse --short HEAD)
- docker push $DOCKER_USERNAME/tenncor-test:travis-latest
- stage: test
script:
- docker run -e COVERALLS_TOKEN=${COVERALLS_TOKEN}
--rm $DOCKER_USERNAME/tenncor-test:travis-$(git rev-parse --short HEAD)
--rm $DOCKER_USERNAME/tenncor-test:travis-latest

notifications:
email: false
Expand Down
15 changes: 3 additions & 12 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@ package(
filegroup(
name = "srcs",
srcs = [
"//err:srcs",
"//ade:srcs",
"//age:srcs",
"//bwd:srcs",
"//dbg:srcs",
"//llo:srcs",
"//pbm:srcs",
"BUILD.bazel",
],
)

filegroup(
name = "test_srcs",
srcs = [
"//ade:test_srcs",
"//llo:test_srcs",
"//pbm:test_srcs",
"//testutil:srcs",
],
)

filegroup(
name = "credentials",
srcs = [
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = README.md ade llo pbm
INPUT = README.md err ade age bwd

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
149 changes: 56 additions & 93 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ GTEST_REPEAT := 50

COVERAGE_INFO_FILE := coverage.info

ADE_LTEST := //ade:test_log
ERR_TEST := //err:test

ADE_DTEST := //ade:test_dynamic
ADE_TEST := //ade:test

ADE_STEST := //ade:test_static
BWD_TEST := //bwd:test

LLO_TEST := //llo:test_llo
AGE_TEST := //age:test

REGRESS_TEST := //llo:test_regress

PBM_TEST := //pbm:test_pbm
AGE_CTEST := //age:ctest


COMMON_BZL_FLAGS := --test_output=all --cache_test_results=no
Expand Down Expand Up @@ -44,136 +42,101 @@ COVERAGE_PIPE := ./scripts/merge_cov.sh $(COVERAGE_INFO_FILE)

TMP_LOGFILE := /tmp/tenncor-test.log

all: test

# all tests

test: test_ade test_llo test_pbm

test_ade: test_ade_log test_ade_dynamic test_ade_static
test: test_err test_ade test_age test_bwd test_cage

test_ade_log:
$(GTEST) $(ADE_LTEST)
test_err:
$(GTEST) $(ERR_TEST)

test_ade_dynamic:
$(GTEST) $(REP_BZL_FLAGS) $(ADE_DTEST)
test_ade:
$(GTEST) $(REP_BZL_FLAGS) $(ADE_TEST)

test_ade_static:
$(GTEST) $(ADE_STEST)
test_bwd:
$(GTEST) $(BWD_TEST)

test_llo:
$(GTEST) $(REP_BZL_FLAGS) $(LLO_TEST)
test_age:
$(TEST) $(AGE_TEST)

test_pbm:
$(GTEST) $(PBM_TEST)
test_cage:
$(GTEST) $(AGE_CTEST)

# valgrind unit tests

valgrind: valgrind_ade valgrind_llo valgrind_pbm

valgrind_ade: valgrind_ade_log valgrind_ade_dynamic valgrind_ade_static
valgrind: valgrind_err valgrind_ade valgrind_bwd valgrind_cage

valgrind_ade_log:
$(GTEST) $(VAL_BZL_FLAGS) $(ADE_LTEST)
valgrind_err:
$(GTEST) $(VAL_BZL_FLAGS) $(ERR_TEST)

valgrind_ade_dynamic:
$(GTEST) $(VAL_BZL_FLAGS) --action_env="GTEST_REPEAT=5" $(ADE_DTEST)
valgrind_ade:
$(GTEST) $(VAL_BZL_FLAGS) --action_env="GTEST_REPEAT=5" $(ADE_TEST)

valgrind_ade_static:
$(GTEST) $(VAL_BZL_FLAGS) $(ADE_STEST)
valgrind_bwd:
$(GTEST) $(VAL_BZL_FLAGS) $(BWD_TEST)

valgrind_llo:
$(GTEST) $(VAL_BZL_FLAGS) --action_env="GTEST_REPEAT=5" $(LLO_TEST)

valgrind_pbm:
$(GTEST) $(VAL_BZL_FLAGS) $(PBM_TEST)
valgrind_cage:
$(GTEST) $(VAL_BZL_FLAGS) $(AGE_CTEST)

# asan unit tests

asan: asan_ade asan_llo asan_pbm

asan_ade: asan_ade_log asan_ade_dynamic asan_ade_static
asan: asan_err asan_ade asan_bwd asan_cage

asan_ade_log:
$(GTEST) $(ASAN_BZL_FLAGS) $(ADE_LTEST)
asan_err:
$(GTEST) $(ASAN_BZL_FLAGS) $(ERR_TEST)

asan_ade_dynamic:
$(GTEST) $(ASAN_BZL_FLAGS) $(REP_BZL_FLAGS) $(ADE_DTEST)
asan_ade:
$(GTEST) $(ASAN_BZL_FLAGS) $(REP_BZL_FLAGS) $(ADE_TEST)

asan_ade_static:
$(GTEST) $(ASAN_BZL_FLAGS) $(ADE_STEST)
asan_bwd:
$(GTEST) $(ASAN_BZL_FLAGS) $(BWD_TEST)

asan_llo:
$(GTEST) $(ASAN_BZL_FLAGS) $(REP_BZL_FLAGS) $(LLO_TEST)

asan_pbm:
$(GTEST) $(ASAN_BZL_FLAGS) $(PBM_TEST)
asan_cage:
$(GTEST) $(ASAN_BZL_FLAGS) $(AGE_CTEST)

# coverage unit tests

coverage: cover_ade cover_llo cover_pbm

cover_ade: cover_ade_log cover_ade_dynamic cover_ade_static

cover_ade_log:
$(COVER) --instrumentation_filter= $(ADE_LTEST)
coverage: cover_err cover_ade cover_bwd

cover_ade_dynamic:
$(COVER) $(REP_BZL_FLAGS) --instrumentation_filter= $(ADE_DTEST)
cover_err:
$(COVER) --instrumentation_filter= $(ERR_TEST)

cover_ade_static:
$(COVER) --instrumentation_filter= $(ADE_STEST)
cover_ade:
$(COVER) $(REP_BZL_FLAGS) --instrumentation_filter= $(ADE_TEST)

cover_llo:
$(COVER) $(REP_BZL_FLAGS) --instrumentation_filter= $(LLO_TEST)
cover_bwd:
$(COVER) $(BWD_TEST)

cover_pbm:
$(COVER) --instrumentation_filter= $(PBM_TEST)

# generate coverage.info
# generated coverage files

lcov_all: coverage
rm -f $(TMP_LOGFILE)
cat bazel-testlogs/ade/test_log/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/ade/test_dynamic/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/ade/test_static/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/llo/test_llo/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/pbm/test_pbm/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/err/test/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/ade/test/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/bwd/test/test.log >> $(TMP_LOGFILE)
cat $(TMP_LOGFILE) | $(COVERAGE_PIPE)
lcov --remove $(COVERAGE_INFO_FILE) $(COVERAGE_IGNORE) -o $(COVERAGE_INFO_FILE)
rm -f $(TMP_LOGFILE)
lcov --list $(COVERAGE_INFO_FILE)

lcov_ade: cover_ade
rm -f $(TMP_LOGFILE)
cat bazel-testlogs/ade/test_log/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/ade/test_dynamic/test.log >> $(TMP_LOGFILE)
cat bazel-testlogs/ade/test_static/test.log >> $(TMP_LOGFILE)
cat $(TMP_LOGFILE) | $(COVERAGE_PIPE)
lcov_err: cover_err
cat bazel-testlogs/err/test/test.log | $(COVERAGE_PIPE)
lcov --remove $(COVERAGE_INFO_FILE) $(COVERAGE_IGNORE) -o $(COVERAGE_INFO_FILE)
rm -f $(TMP_LOGFILE)
lcov --list $(COVERAGE_INFO_FILE)

lcov_llo: cover_llo
cat bazel-testlogs/llo/test_llo/test.log | $(COVERAGE_PIPE)
lcov --remove $(COVERAGE_INFO_FILE) $(COVERAGE_IGNORE) 'ade/*' -o $(COVERAGE_INFO_FILE)
lcov_ade: cover_ade
cat bazel-testlogs/ade/test/test.log | $(COVERAGE_PIPE)
lcov --remove $(COVERAGE_INFO_FILE) $(COVERAGE_IGNORE) 'log/*' -o $(COVERAGE_INFO_FILE)
lcov --list $(COVERAGE_INFO_FILE)

lcov_pbm: cover_pbm
cat bazel-testlogs/pbm/test_pbm/test.log | $(COVERAGE_PIPE)
lcov --remove $(COVERAGE_INFO_FILE) $(COVERAGE_IGNORE) 'ade/*' 'llo/*' -o $(COVERAGE_INFO_FILE)
lcov_bwd: cover_bwd
rm -f $(TMP_LOGFILE)
cat bazel-testlogs/bwd/test/test.log | $(COVERAGE_PIPE)
lcov --remove $(COVERAGE_INFO_FILE) $(COVERAGE_IGNORE) 'log/*' 'ade/*' -o $(COVERAGE_INFO_FILE)
rm -f $(TMP_LOGFILE)
lcov --list $(COVERAGE_INFO_FILE)

# test management

dora_run:
./scripts/start_dora.sh ./certs

gen_test: dora_run
bazel run //test_gen:tfgen

test_regress: gen_test
$(GTEST) $(REGRESS_TEST)

# deployment

docs:
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ A tensor is an N-dimensional container that organizes its content by some shape.
This module supplies syntax tree for equation and generates derivative.
Constraints to the equation is limited to each tensor's shape.

- [LLO (Low Level Operators)](llo/README_LLO.md)
- [AGE (ADE Generation Engine)](age/README_LLO.md)

This module is a sample library of data operators mapped to the ADE opcodes.
Expect this module to split when I decide to depend on external libraries (like eigen).

- [PBM (Protobuf Marshaller)](pbm/README_PBM.md)

This module marshals llo-extended ade graph
This generator creates glue layer between ADE and data manipulation libraries as well as map operational codes to its respective chain rule. AGE also provides a runtime library to evaluate derivatives using the mapped chain rules.

## Tools and utility

Expand Down
24 changes: 8 additions & 16 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
workspace(name = "com_github_mingkaic_tenncor")

load("//:tenncor.bzl", "dependencies", "test_dependencies")
# test dependencies


# ade and llo libraries have no external dependencies

# get dependencies for pbm
dependencies()

load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_repositories")

cpp_proto_repositories()


# get dependencies for tests
test_dependencies()
git_repository(
name = "com_github_mingkaic_testify",
remote = "https://github.com/raggledodo/testify",
commit = "e96e793b7082c3eb95f6177d5e7b0612ef6cd29c",
)

load("@com_github_mingkaic_testify//:testify.bzl", "dependencies")

Expand All @@ -24,6 +16,6 @@ load("@com_github_raggledodo_dora//:dora.bzl", "dependencies")

dependencies()

load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories")
load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_repositories")

py_proto_repositories()
cpp_proto_repositories()
Loading

0 comments on commit 06da23c

Please sign in to comment.