All Projects → tkf → Threadsx.jl

tkf / Threadsx.jl

Licence: mit
Parallelized Base functions

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Threadsx.jl

Floops.jl
Fast sequential, threaded, and distributed for-loops for Julia—fold for humans™
Stars: ✭ 96 (-23.81%)
Mutual labels:  parallel, high-performance
ultra-sort
DSL for SIMD Sorting on AVX2 & AVX512
Stars: ✭ 29 (-76.98%)
Mutual labels:  parallel, sorting-algorithms
Transducers.jl
Efficient transducers for Julia
Stars: ✭ 226 (+79.37%)
Mutual labels:  parallel, high-performance
hatrack
Fast, multi-reader, multi-writer, lockless data structures for parallel programming
Stars: ✭ 55 (-56.35%)
Mutual labels:  high-performance, parallel
MultiHttp
This is a high performance , very useful multi-curl tool written in php. 一个超级好用的并发CURL工具!!!(httpful,restful, concurrency)
Stars: ✭ 79 (-37.3%)
Mutual labels:  high-performance, parallel
Corium
Corium is a modern scripting language which combines simple, safe and efficient programming.
Stars: ✭ 18 (-85.71%)
Mutual labels:  high-performance, parallel
FoldsCUDA.jl
Data-parallelism on CUDA using Transducers.jl and for loops (FLoops.jl)
Stars: ✭ 48 (-61.9%)
Mutual labels:  high-performance, parallel
data-parallelism
juliafolds.github.io/data-parallelism/
Stars: ✭ 22 (-82.54%)
Mutual labels:  high-performance, parallel
Highs
Linear optimization software
Stars: ✭ 107 (-15.08%)
Mutual labels:  parallel, high-performance
Nanolog
Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API.
Stars: ✭ 1,710 (+1257.14%)
Mutual labels:  high-performance
Bach
Compose your async functions with elegance.
Stars: ✭ 117 (-7.14%)
Mutual labels:  parallel
Index
Metarhia educational program index 📖
Stars: ✭ 2,045 (+1523.02%)
Mutual labels:  parallel
Pandarallel
A simple and efficient tool to parallelize Pandas operations on all available CPUs
Stars: ✭ 1,887 (+1397.62%)
Mutual labels:  parallel
Redo
Smaller, easier, more powerful, and more reliable than make. An implementation of djb's redo.
Stars: ✭ 1,589 (+1161.11%)
Mutual labels:  parallel
Zanphp
PHP开发面向C10K+的高并发SOA服务 和RPC服务首选框架
Stars: ✭ 1,451 (+1051.59%)
Mutual labels:  high-performance
Rapidoid
Rapidoid - Extremely Fast, Simple and Powerful Java Web Framework and HTTP Server!
Stars: ✭ 1,571 (+1146.83%)
Mutual labels:  high-performance
Tlaplus
TLC is an explicit state model checker for specifications written in TLA+. The TLA+Toolbox is an IDE for TLA+.
Stars: ✭ 1,618 (+1184.13%)
Mutual labels:  high-performance
Java
All Algorithms implemented in Java
Stars: ✭ 42,893 (+33942.06%)
Mutual labels:  sorting-algorithms
Android Download Manager Pro
Android/Java download manager library help you to download files in parallel mechanism in some chunks.
Stars: ✭ 1,568 (+1144.44%)
Mutual labels:  parallel
Nimble
Stars: ✭ 121 (-3.97%)
Mutual labels:  parallel

Threads⨉: Parallelized Base functions

Dev GitHub Actions Aqua QA

tl;dr

Add prefix ThreadsX. to functions from Base to get some speedup, if supported. Example:

julia> using ThreadsX

julia> ThreadsX.sum(gcd(42, i) == 1 for i in 1:10_000)
2857

To find out functions supported by ThreadsX.jl, just type ThreadsX. + TAB in the REPL:

julia> ThreadsX.
MergeSort       any             findfirst       map!            reduce
QuickSort       collect         findlast        mapreduce       sort
Set             count           foreach         maximum         sort!
StableQuickSort extrema         issorted        minimum         sum
all             findall         map             prod            unique

Interoperability

Rich collection support

The reduce-based functions support any collections that implement SplittablesBase.jl interface including arrays, Dict, Set, and iterator transformations. In particular, these functions support iterator comprehension:

julia> ThreadsX.sum(y for x in 1:10 if isodd(x) for y in 1:x^2)
4917

For advanced usage, they also support Transducers.eduction constructed with parallelizable transducers.

OnlineStats.jl

ThreadsX.reduce supports an OnlineStat from OnlineStats.jl as the first argument as long as it implements the merging interface:

julia> using OnlineStats: Mean

julia> ThreadsX.reduce(Mean(), 1:10)
Mean: n=10 | value=5.5

API

ThreadsX.jl is aiming at providing API compatible with Base functions to easily parallelize Julia programs.

All functions that exist directly under ThreadsX namespace are public API and they implement a subset of API provided by Base. Everything inside ThreadsX.Implementations is implementation detail. The public API functions of ThreadsX expect that the data structure and function(s) passed as argument are "thread-friendly" in the sense that operating on distinct elements in the given container from multiple tasks in parallel is safe. For example, ThreadsX.sum(f, array) assumes that executing f(::eltype(array)) and accessing elements as in array[i] from multiple threads is safe. In particular, this is the case if array is a Vector of immutable objects and f is a pure function in the sense it does not mutate any global objects. Note that it is not required and not recommended to use "thread-safe" array that protects accessing array[i] by a lock.

In addition to the Base API, all functions accept keyword argument basesize::Integer to configure the number of elements processed by each thread. A large value is useful for minimizing the overhead of using multiple threads. A small value is useful for load balancing when the time to process single item varies a lot from item to item. The default value of basesize for each function is currently an implementation detail.

ThreadsX.jl API is deterministic in the sense that the same input produces the same output, independent of how julia's task scheduler decide to execute the tasks. However, note that basesize is a part of the input which may be set based on Threads.nthreads(). To make the result of the computation independent of Threads.nthreads() value, basesize must be specified explicitly.

Limitations

  • Keyword argument dims is not supported yet.
  • (There are probably more.)

Implementations

Most of reduce-based functions are implemented as thin wrappers of Transducers.jl.

Custom collections can support ThreadsX.jl API by implementing SplittablesBase.jl interface.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].