Skip to content

Commit bd18ba7

Browse files
committed
setup the framework
1 parent c275072 commit bd18ba7

File tree

13 files changed

+62
-28
lines changed

13 files changed

+62
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ Manifest.toml
33
*.jl.cov
44
*.jl.mem
55
/docs/build/
6+
/docs/src/generated/
67
.vscode/
78
Session.vim

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ pkg> add TensorInference
3030
To update, just type `up` in the package mode.
3131

3232
## Examples
33-
Examples are in the [example](example) folder, which contains the following list of example problems
34-
- [asia network](example/asia)
33+
Examples are in the [examples](examples) folder, which contains the following list of example problems
34+
- [asia network](examples/asia)
3535

3636

3737
## Supporting and Citing

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
4+
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
45
TensorInference = "c2297e78-99bd-40ad-871d-f50e56b81012"

docs/make.jl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using TensorInference
2-
using TensorInference: OMEinsum, OMEinsumContractionOrders
2+
using TensorInference: OMEinsum
3+
using TensorInference.OMEinsum: OMEinsumContractionOrders
34
using Documenter, Literate
45

56
# Literate
6-
for each in readdir(pkgdir(TensorInference, "examples"))
7-
input_file = pkgdir(TensorInference, "examples", each)
8-
endswith(input_file, ".jl") || continue
7+
const EXAMPLE_DIR = pkgdir(TensorInference, "examples")
8+
const LITERATE_GENERATED_DIR = pkgdir(TensorInference, "docs", "src", "generated")
9+
for each in readdir(EXAMPLE_DIR)
10+
workdir = joinpath(LITERATE_GENERATED_DIR, each)
11+
cp(joinpath(EXAMPLE_DIR, each), workdir; force=true)
12+
input_file = joinpath(workdir, "main.jl")
913
@info "building" input_file
10-
output_dir = pkgdir(TensorInference, "docs", "src", "generated")
11-
Literate.markdown(input_file, output_dir; name=each[1:end-3], execute=false)
14+
Literate.markdown(input_file, workdir; execute=true)
1215
end
1316

1417
DocMeta.setdocmeta!(TensorInference, :DocTestSetup, :(using TensorInference); recursive=true)
@@ -27,7 +30,7 @@ makedocs(;
2730
pages=[
2831
"Home" => "index.md",
2932
"Examples" => [
30-
"Asia network" => "generated/asia.md",
33+
"Asia network" => "generated/asia/main.md",
3134
],
3235
"Performance Tips" => "performance.md",
3336
"References" => "ref.md",

docs/serve.jl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
function serve(;host::String="0.0.0.0", port::Int=8000)
2+
# setup environment
3+
docs_dir = @__DIR__
4+
julia_cmd = "using Pkg; Pkg.instantiate()"
5+
run(`$(Base.julia_exename()) --project=$docs_dir -e $julia_cmd`)
6+
7+
serve_cmd = """
8+
using LiveServer;
9+
LiveServer.servedocs(;
10+
doc_env=false,
11+
skip_dirs=[
12+
joinpath("docs", "src", "generated"),
13+
joinpath("docs", "build"),
14+
],
15+
skip_files=[
16+
joinpath("docs", "Manifest.toml"),
17+
],
18+
literate="examples",
19+
host=\"$host\",
20+
port=$port,
21+
)
22+
"""
23+
try
24+
run(`$(Base.julia_exename()) --project=$docs_dir -e $serve_cmd`)
25+
catch e
26+
if e isa InterruptException
27+
return
28+
else
29+
rethrow(e)
30+
end
31+
end
32+
return
33+
end
34+
35+
serve()

docs/src/index.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,4 @@ CurrentModule = TensorInference
44

55
# TensorInference
66

7-
Documentation for [TensorInference](https://github.com/TensorBFS/TensorInference.jl).
8-
9-
```@index
10-
```
11-
12-
```@autodocs
13-
Modules = [TensorInference]
14-
```
7+
Documentation for [TensorInference](https://github.com/TensorBFS/TensorInference.jl).

docs/src/performance.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
Let us use the independent set problem on 3-regular graphs as an example.
55
```julia
6-
julia> using TensorInferece, Artifacts
6+
julia> using TensorInference, Artifacts, Pkg
77

8+
julia> Pkg.ensure_artifact_installed("uai2014", pkgdir(TensorInference, "test", "Artifacts.toml"));
89

910
julia> function get_instance_filepaths(problem_name::AbstractString, task::AbstractString)
1011
model_filepath = joinpath(artifact"uai2014", task, problem_name * ".uai")

docs/src/ref.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
```@autodocs
55
Modules = [TensorInference]
66
Order = [:function, :type]
7+
Private = false
78
```
89

910
## Tensor Network
1011
```@docs
11-
optimize_code
12-
getixsv
13-
getiyv
1412
contraction_complexity
15-
estimate_memory
16-
@ein_str
1713
GreedyMethod
1814
TreeSA
1915
SABipartite
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)