Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end
for example in ["cholesky", "blur-roberts", "lcs", "sort"]
println("\n*** Generating $example example")
@time begin
dir = joinpath(DataFlowTasks.PROJECT_ROOT, "docs", "src", "examples", example)
dir = joinpath(DataFlowTasks._get_dataflowtasks_root(), "docs", "src", "examples", example)
src = joinpath(dir, "$(example).jl")
Literate.markdown(src, dir)
draft || Literate.notebook(src, dir; preprocess = insert_setup)
Expand All @@ -37,7 +37,7 @@ end

# generate readme
println("\n*** Generating README")
@time cd(joinpath(DataFlowTasks.PROJECT_ROOT, "docs", "src", "readme")) do
@time cd(joinpath(DataFlowTasks._get_dataflowtasks_root(), "docs", "src", "readme")) do
src = joinpath(pwd(), "README.jl")

# Run code
Expand Down
25 changes: 24 additions & 1 deletion src/DataFlowTasks.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
__precompile__()

"""
module DataFlowTask

Create `Task`s which can keep track of how data flows through it.
"""
module DataFlowTasks

const PROJECT_ROOT = pkgdir(DataFlowTasks)
dir = pkgdir(DataFlowTasks)
@static if VERSION > v"1.8"
const PROJECT_ROOT::Ref{String} = Ref{String}(dir)
else
const PROJECT_ROOT = Ref{String}(dir)
end

using OrderedCollections
using Compat
Expand All @@ -16,6 +23,18 @@ using Printf

export @dspawn, @dasync

"""
_get_dataflowtasks_root()

Returns the current `PROJECT_ROOT` value.

Does not assume the ref has been set.
"""
function _get_dataflowtasks_root()
global PROJECT_ROOT
return PROJECT_ROOT[]
end

"""
@enum AccessMode READ WRITE READWRITE

Expand All @@ -40,6 +59,10 @@ include("dag.jl")
include("taskgraph.jl")
include("arrayinterface.jl")

"""
__init__()

"""
function __init__()
# default scheduler
capacity = 50
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
DataFlowTasks = "d1549cb6-e9f4-42f8-98cc-ffc8d067ff5b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Expand Down
2 changes: 1 addition & 1 deletion test/priorityscheduler_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ background = false
sch = DataFlowTasks.PriorityScheduler(100, background)
DataFlowTasks.setscheduler!(sch)

include(joinpath(DataFlowTasks.PROJECT_ROOT, "test", "testutils.jl"))
include(joinpath(DataFlowTasks._get_dataflowtasks_root(), "test", "testutils.jl"))

@testset "Priority scheduler" begin
@testset "Fork-join" begin
Expand Down
2 changes: 1 addition & 1 deletion test/staticscheduler_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using LinearAlgebra
sch = DataFlowTasks.StaticScheduler()
DataFlowTasks.setscheduler!(sch)

include(joinpath(DataFlowTasks.PROJECT_ROOT, "test", "testutils.jl"))
include(joinpath(DataFlowTasks._get_dataflowtasks_root(), "test", "testutils.jl"))

@testset "Static scheduler" begin
@testset "Fork-join" begin
Expand Down
2 changes: 1 addition & 1 deletion test/taskgraph_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using LinearAlgebra
using DataFlowTasks
import DataFlowTasks as DFT

include(joinpath(DFT.PROJECT_ROOT, "test", "testutils.jl"))
include(joinpath(DFT._get_dataflowtasks_root(), "test", "testutils.jl"))

tg = DFT.TaskGraph(200)
DFT.set_active_taskgraph!(tg)
Expand Down
Loading