Skip to content

Compatibility to Julia 1.5 #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 10, 2020
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/Testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- '1.2'
- '1.3'
- '1.4'
- 'nightly'
os:
- ubuntu-latest
- windows-latest
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,23 @@ Disclaimer: This feature is still experimental and should only be used with caut
## For Developer

### Release a new version
Update the new version number in `Project.toml`, a tag to that
version will be made by the GitHub Actions after it is pushed.
- If you have updates of the binary dylib (files under the `deps`
directory), you should:
- Update the version/commit information in [this
file](https://github.com/JuliaPackaging/Yggdrasil/blob/master/L/Libtask/build_tarballs.jl)
by a pull request
- Wait for that PR being merged, then you will find a new
release of the dylib
[here](https://github.com/JuliaBinaryWrappers/Libtask_jll.jl/releases)
- Then, in the root directory of the Yggdrasil project, run
`https://github.com/JuliaBinaryWrappers/Libtask_jll.jl/releases`,
you will get a build file like
`build/build_Libtask.v0.3.1.jl`. Copy the binary download
information (the variables `bin_prefix` and `download_info`)
from that generated file to `deps/build.jl` in our repo and
commit the changes.
- If you don't make any changes about the dylib, just ignore the
first step and go to next one.
- Update the new version number in `Project.toml`, ping
@JuliaRegistrator with `@JuliaRegistrator register` in a
comment.
14 changes: 7 additions & 7 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ length(products_tmp) == 0 && (products_tmp = [products[end]])
products = products_tmp

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaBinaryWrappers/Libtask_jll.jl/releases/download/Libtask-v0.3.0+0"
bin_prefix = "https://github.com/JuliaBinaryWrappers/Libtask_jll.jl/releases/download/Libtask-v0.3.1+0"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.0.aarch64-linux-gnu.tar.gz", "e541c0df11d48b45e9334018c014ae0d012b75f92ffbc49fc4ab6eed35593731"),
Linux(:i686, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.0.i686-linux-gnu.tar.gz", "7f68bd21609adf35878f9b16f56151ab5f6f609999a40291ed270c1a4d0331a0"),
Windows(:i686) => ("$bin_prefix/Libtask.v0.3.0.i686-w64-mingw32.tar.gz", "62950b53a892fb8c699ddbb4ccc9f19b12681f64fbf85a546345d5b0f23dc8d7"),
MacOS(:x86_64) => ("$bin_prefix/Libtask.v0.3.0.x86_64-apple-darwin14.tar.gz", "fff6523dde93e6dc12b96a8bf1e3c35a78d8dba7cdc95cd0e5dd13225d1972df"),
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.0.x86_64-linux-gnu.tar.gz", "be4c590e8f13df31855be20f31c1c4ce98f499fc5173cd35c8e8b72b79e0dc5a"),
Windows(:x86_64) => ("$bin_prefix/Libtask.v0.3.0.x86_64-w64-mingw32.tar.gz", "267473eb211e5060b98cede7f30336d2a7453542617521f27941d353dcfe42e8"),
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.1.aarch64-linux-gnu.tar.gz", "ad342e90969280fcd198993947fb27a052357c278e40645574b93f13b9f49f25"),
Linux(:i686, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.1.i686-linux-gnu.tar.gz", "a4061a2098da96cd6c49300b2895a61ce02d822c603ba85995d300149c9cec5e"),
Windows(:i686) => ("$bin_prefix/Libtask.v0.3.1.i686-w64-mingw32.tar.gz", "e38da986025dac5767da841cc3666973a303061f4b853c0821fc25de4802f674"),
MacOS(:x86_64) => ("$bin_prefix/Libtask.v0.3.1.x86_64-apple-darwin14.tar.gz", "93bf6be03236252eea33998c5fa4f0a8173d44b20266e8e05473a2ae957eebde"),
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.1.x86_64-linux-gnu.tar.gz", "349fc5fdd1d1234f1c1467fd655b9a5e18ac926e5b16db4ba7743b75a9540739"),
Windows(:x86_64) => ("$bin_prefix/Libtask.v0.3.1.x86_64-w64-mingw32.tar.gz", "837410807715caf15b931f04c968a3ca8967bd0d70df888d1ed535a1679030d0"),
)

# Install unsatisfied or updated dependencies:
Expand Down
1 change: 1 addition & 0 deletions deps/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "julia.h"

// Workaround for JuliaLang/julia#32812
jl_task_t *vanilla_get_current_task(void)
{
jl_ptls_t ptls = jl_get_ptls_states();
Expand Down
14 changes: 8 additions & 6 deletions src/taskcopy.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Utility function for self-copying mechanism

n_copies() = n_copies(current_task())
_current_task() = ccall((:vanilla_get_current_task, libtask), Ref{Task}, ())

n_copies() = n_copies(_current_task())
n_copies(t::Task) = begin
isa(t.storage, Nothing) && (t.storage = IdDict())
if haskey(t.storage, :n_copies)
Expand Down Expand Up @@ -34,14 +36,14 @@ proper way is refreshing the `current_task` (the variable `t`) in
function task_wrapper(func)
() ->
try
ct = current_task()
ct = _current_task()
res = func()
ct.result = res
isa(ct.storage, Nothing) && (ct.storage = IdDict())
ct.storage[:_libtask_state] = :done
wait()
catch ex
ct = current_task()
ct = _current_task()
ct.exception = ex
ct.result = ex
ct.backtrace = catch_backtrace()
Expand Down Expand Up @@ -92,7 +94,7 @@ function Base.show(io::IO, exc::CTaskException)
end

produce(v) = begin
ct = current_task()
ct = _current_task()

if ct.storage == nothing
ct.storage = IdDict()
Expand Down Expand Up @@ -126,7 +128,7 @@ produce(v) = begin
if empty
schedule(t, v)
wait()
ct = current_task() # When a task is copied, ct should be updated to new task ID.
ct = _current_task() # When a task is copied, ct should be updated to new task ID.
while true
# wait until there are more consumers
q = ct.storage[:consumers]
Expand Down Expand Up @@ -159,7 +161,7 @@ consume(p::Task, values...) = begin
return wait(p)
end

ct = current_task()
ct = _current_task()
ct.result = length(values)==1 ? values[1] : values

#### un-optimized version
Expand Down
4 changes: 2 additions & 2 deletions test/tarray3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ using Test
function f_ct()
ta = tzeros(UInt64, 4);
for i in 1:4
ta[i] = hash(current_task())
DATA[current_task()] = convert(Array, ta)
ta[i] = hash(Libtask._current_task())
DATA[Libtask._current_task()] = convert(Array, ta)
produce(ta[i])
end
end
Expand Down