From 58df9f41c00f7ac57c23087211e3030da9d38d49 Mon Sep 17 00:00:00 2001 From: KDr2 Date: Wed, 8 Apr 2020 18:55:13 +0800 Subject: [PATCH 1/3] compatibility to Julia 1.5 --- .github/workflows/Testing.yaml | 1 + deps/build.jl | 14 +++++++------- src/taskcopy.jl | 14 ++++++++------ test/tarray3.jl | 4 ++-- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/Testing.yaml b/.github/workflows/Testing.yaml index 083c9e3a..ab9e46b9 100644 --- a/.github/workflows/Testing.yaml +++ b/.github/workflows/Testing.yaml @@ -19,6 +19,7 @@ jobs: - '1.2' - '1.3' - '1.4' + - 'nightly' os: - ubuntu-latest - windows-latest diff --git a/deps/build.jl b/deps/build.jl index 2c072b31..48b9dcb9 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -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: diff --git a/src/taskcopy.jl b/src/taskcopy.jl index dd94daca..a1309e02 100644 --- a/src/taskcopy.jl +++ b/src/taskcopy.jl @@ -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) @@ -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() @@ -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() @@ -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] @@ -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 diff --git a/test/tarray3.jl b/test/tarray3.jl index 9fa47bcd..36466450 100644 --- a/test/tarray3.jl +++ b/test/tarray3.jl @@ -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 From 80ab764c525e1834eb4bf255e69834a6aeda7a54 Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Wed, 8 Apr 2020 15:16:58 +0100 Subject: [PATCH 2/3] Update task.c --- deps/task.c | 1 + 1 file changed, 1 insertion(+) diff --git a/deps/task.c b/deps/task.c index f9596e4d..7eb16eb9 100644 --- a/deps/task.c +++ b/deps/task.c @@ -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(); From 77d359ec574431c7ab0d04da45f15da4c1228c78 Mon Sep 17 00:00:00 2001 From: KDr2 Date: Fri, 10 Apr 2020 09:23:54 +0800 Subject: [PATCH 3/3] document update --- README.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a2247186..e7991b87 100644 --- a/README.md +++ b/README.md @@ -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.