diff --git a/.gitea/workflows/julia-package-ci.yml b/.gitea/workflows/julia-package-ci.yml index 446f366..7bf1568 100644 --- a/.gitea/workflows/julia-package-ci.yml +++ b/.gitea/workflows/julia-package-ci.yml @@ -28,3 +28,6 @@ jobs: - name: Run tests run: julia --project -e 'import Pkg; Pkg.test()' + + - name: Run examples + run: julia --project -e 'import Pkg; include("examples/import_bench.jl")' diff --git a/examples/ABAB_graph.jl b/examples/ABAB_graph.jl index 05037c9..50cfd68 100644 --- a/examples/ABAB_graph.jl +++ b/examples/ABAB_graph.jl @@ -1,4 +1,4 @@ -using metagraph_optimization +using MetagraphOptimization function main() graph = DAG() diff --git a/examples/import_bench.jl b/examples/import_bench.jl index ef138c5..61f3671 100644 --- a/examples/import_bench.jl +++ b/examples/import_bench.jl @@ -8,6 +8,10 @@ function bench_txt(filepath::String, bench::Bool = true) name, _ = splitext(name) filepath = joinpath(@__DIR__, filepath) + if !isfile(filepath) + println("File ", filepath, " does not exist, skipping bench") + return + end println(name, ":") g = import_txt(filepath) diff --git a/src/MetagraphOptimization.jl b/src/MetagraphOptimization.jl index 2c87bf3..594675b 100644 --- a/src/MetagraphOptimization.jl +++ b/src/MetagraphOptimization.jl @@ -1,21 +1,4 @@ module MetagraphOptimization -import Base.show -import Base.== -import Base.in -import Base.copy - -include("tasks.jl") -include("nodes.jl") -include("graph.jl") -include("task_functions.jl") -include("node_functions.jl") -include("graph_functions.jl") -include("graph_operations.jl") -include("import.jl") -include("utility.jl") - -include("abc_model/tasks.jl") -include("abc_model/task_functions.jl") export Node, Edge, ComputeTaskNode, DataTaskNode, DAG export AbstractTask, AbstractComputeTask, AbstractDataTask, DataTask, ComputeTaskP, ComputeTaskS1, ComputeTaskS2, ComputeTaskV, ComputeTaskU, ComputeTaskSum, FusedComputeTask @@ -27,4 +10,25 @@ export ==, in, show export bytes_to_human_readable + +import Base.show +import Base.== +import Base.in +import Base.copy + + +include("tasks.jl") +include("nodes.jl") +include("graph.jl") + +include("task_functions.jl") +include("node_functions.jl") +include("graph_functions.jl") +include("graph_operations.jl") +include("import.jl") +include("utility.jl") + +include("abc_model/tasks.jl") +include("abc_model/task_functions.jl") + end # module MetagraphOptimization diff --git a/src/graph.jl b/src/graph.jl index 920b382..d56fc4b 100644 --- a/src/graph.jl +++ b/src/graph.jl @@ -51,18 +51,18 @@ end mutable struct PossibleOperations - nodeFusions::Vector{NodeFusion} - nodeReductions::Vector{NodeReduction} - nodeSplits::Vector{NodeSplit} + nodeFusions::Set{NodeFusion} + nodeReductions::Set{NodeReduction} + nodeSplits::Set{NodeSplit} dirty::Bool end function PossibleOperations() return PossibleOperations( - Vector{NodeFusion}(), - Vector{NodeReduction}(), - Vector{NodeSplit}(), - false + Set{NodeFusion}(), + Set{NodeReduction}(), + Set{NodeSplit}(), + true ) end