https://github.com/jw3126/threadingtools.jl
https://github.com/jw3126/threadingtools.jl
julia multithreading
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jw3126/threadingtools.jl
- Owner: jw3126
- License: mit
- Created: 2019-06-21T22:41:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-26T09:48:54.000Z (almost 7 years ago)
- Last Synced: 2025-04-05T04:26:53.644Z (about 1 year ago)
- Topics: julia, multithreading
- Language: Julia
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ThreadingTools
[](https://travis-ci.com/jw3126/ThreadingTools.jl)
[](https://ci.appveyor.com/project/jw3126/ThreadingTools-jl)
[](https://codecov.io/gh/jw3126/ThreadingTools.jl)
[](https://coveralls.io/github/jw3126/ThreadingTools.jl?branch=master)
# Usage
ThreadingTools defines threaded versions of the following functions: `map, map!, mapreduce, reduce, sum, prod, minimum, maximum`
```julia
julia> using ThreadingTools
julia> using BenchmarkTools
julia> Threads.nthreads()
4
julia> data = randn(10^6);
julia> @btime sum(sin, data)
13.114 ms (1 allocation: 16 bytes)
279.2390057547361
julia> @btime tsum(sin,data)
3.722 ms (60 allocations: 4.09 KiB)
279.23900575473743
julia> @btime mapreduce(sin,*,data)
15.607 ms (1 allocation: 16 bytes)
0.0
julia> @btime tmapreduce(sin,*,data)
3.718 ms (60 allocations: 4.08 KiB)
0.0
```
# Credits
ThreadingTools was inspired by and reuses some code of [`KissThreading`](https://github.com/mohamed82008/KissThreading.jl)