Skip to content

Commit

Permalink
add taskid function, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MasonProtter committed Jan 30, 2024
1 parent 7a8304f commit 13e4bf5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

#### This package is in very early development and is not yet registered

This is meant to be a simple, unambitious package that provides basic, user-friendly ways of doing
multithreaded calculations via higher-order functions, with a focus on [data parallelism](https://en.wikipedia.org/wiki/Data_parallelism).

Unlike most JuliaFolds2 packages, it is not built off of [Transducers.jl](https://github.com/JuliaFolds2/Transducers.jl), nor is it a building block of Transducers.jl, instead OhMyThreads is meant to be a simpler, more maintainable, and more accessible alternative to packages like [ThreadsX.jl](https://github.com/tkf/ThreadsX.jl) or [Folds.jl](https://github.com/JuliaFolds2/Folds.jl).

OhMyThreads.jl re-exports the very useful function `chunks` from [ChunkSplitters.jl](https://github.com/m3g/ChunkSplitters.jl), and provides the following functions:
This is meant to be a simple, unambitious package that provides user-friendly ways of doing task-parallel
multithreaded calculations via higher-order functions, with a focus on
[data parallelism](https://en.wikipedia.org/wiki/Data_parallelism) without needing to expose julia's
[Task](https://docs.julialang.org/en/v1/base/parallel/) model to users.

Unlike most JuliaFolds2 packages, it is not built off of
[Transducers.jl](https://github.com/JuliaFolds2/Transducers.jl), nor is it a building block for Transducers.jl.
Rather, OhMyThreads is meant to be a simpler, more maintainable, and more accessible alternative to packages
like [ThreadsX.jl](https://github.com/tkf/ThreadsX.jl) or [Folds.jl](https://github.com/JuliaFolds2/Folds.jl).

OhMyThreads.jl re-exports the very useful function `chunks` from
[ChunkSplitters.jl](https://github.com/m3g/ChunkSplitters.jl), and provides the following functions:

<details><summary> tmapreduce </summary>
<p>
Expand Down
16 changes: 11 additions & 5 deletions readme_generator.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
using OhMyThreads

open("README.md", "w+") do io
open(joinpath(@__DIR__(), "README.md"), "w+") do io
println(io, """
# OhMyThreads
#### This package is in very early development and is not yet registered
This is meant to be a simple, unambitious package that provides basic, user-friendly ways of doing
multithreaded calculations via higher-order functions, with a focus on [data parallelism](https://en.wikipedia.org/wiki/Data_parallelism).
This is meant to be a simple, unambitious package that provides user-friendly ways of doing task-parallel
multithreaded calculations via higher-order functions, with a focus on
[data parallelism](https://en.wikipedia.org/wiki/Data_parallelism) without needing to expose julia's
[Task](https://docs.julialang.org/en/v1/base/parallel/) model to users.
Unlike most JuliaFolds2 packages, it is not built off of [Transducers.jl](https://github.com/JuliaFolds2/Transducers.jl), nor is it a building block of Transducers.jl, instead OhMyThreads is meant to be a simpler, more maintainable, and more accessible alternative to packages like [ThreadsX.jl](https://github.com/tkf/ThreadsX.jl) or [Folds.jl](https://github.com/JuliaFolds2/Folds.jl).
Unlike most JuliaFolds2 packages, it is not built off of
[Transducers.jl](https://github.com/JuliaFolds2/Transducers.jl), nor is it a building block for Transducers.jl.
Rather, OhMyThreads is meant to be a simpler, more maintainable, and more accessible alternative to packages
like [ThreadsX.jl](https://github.com/tkf/ThreadsX.jl) or [Folds.jl](https://github.com/JuliaFolds2/Folds.jl).
OhMyThreads.jl re-exports the very useful function `chunks` from [ChunkSplitters.jl](https://github.com/m3g/ChunkSplitters.jl), and provides the following functions:
OhMyThreads.jl re-exports the very useful function `chunks` from
[ChunkSplitters.jl](https://github.com/m3g/ChunkSplitters.jl), and provides the following functions:
""")
for sym (:tmapreduce, :treducemap, :treduce, :tmap, :tmap!, :tforeach, :tcollect)
println(io, "<details><summary> $sym </summary>\n<p>\n")
Expand Down
7 changes: 7 additions & 0 deletions src/tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ Returns the thread id of the `n`th Julia thread in the `:default` threadpool.
end
end

"""
taskid() :: UInt
Return a `UInt` identifier for the current running [Task](https://docs.julialang.org/en/v1/base/parallel/#Core.Task). This identifier will
"""
taskid() = objectid(current_task())

end # Tools

0 comments on commit 13e4bf5

Please sign in to comment.