Skip to content

Commit

Permalink
WIP: Add an end-to-end GGNN test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCummins committed Aug 30, 2020
1 parent bb7d056 commit b6c9e94
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
10 changes: 10 additions & 0 deletions programl/task/dataflow/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ py_binary(
],
)

py_test(
name = "train_ggnn_test",
srcs = ["train_ggnn_test.py"],
data = ["//programl/test/data:reachability_dataflow_dataset"],
deps = [
":train_ggnn",
"//third_party/py/labm8",
],
)

py_binary(
name = "train_lstm",
srcs = ["train_lstm.py"],
Expand Down
51 changes: 51 additions & 0 deletions programl/task/dataflow/train_ggnn_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2019-2020 the ProGraML authors.
#
# Contact Chris Cummins <[email protected]>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import subprocess
import sys

from labm8.py import bazelutil, test

TRAIN_GGNN = bazelutil.DataPath("programl/programl/task/dataflow/train_ggnn")


REACHABILITY_DATAFLOW_DATASET = bazelutil.DataArchive(
"programl/programl/test/data/reachability_dataflow_dataset.tar.bz2"
)


def test_reachability_end_to_end():
with REACHABILITY_DATAFLOW_DATASET as d:
p = subprocess.Popen(
[
TRAIN_GGNN,
f"--path={d}",
"--analysis",
"reachability",
"--limit_max_data_flow_steps",
"--layer_timesteps=10",
"--val_graph_count=10",
"--val_seed=204",
"--train_graph_counts=10,20",
"--batch_size=8",
]
)
p.communicate()
if p.returncode:
sys.exit(1)


if __name__ == "__main__":
test.Main()

0 comments on commit b6c9e94

Please sign in to comment.