MoreMaps.Chart Type
sourceMoreMaps.LogLogger Type
LogLogger(; nlogs::Int = 10, level::LogLevel=Info)
LogLogger(nlogs::Int = 10, level::LogLevel=Info)
A progress logger that displays progress information using @info
messages. Shows periodic updates during mapping operations.
Arguments
nlogs::Int
: Number of progress messages to display (default: 10)
Usage
julia> using MoreMaps
julia> C = Chart(LogLogger(3))
julia> data = [1, 2, 3, 4, 5, 6];
julia> result = map(x -> (sleep(0.5); x^2), C, data); # Will show progress messages during execution
julia> result
julia> using Logging # Choose a log level
julia> C = Chart(LogLogger(4, Warn));
julia> map(x -> (sleep(0.5); x + 1), C, [1, 2, 3, 4]);
MoreMaps.NoProgress Type
NoProgress()
The default progress logger that performs no logging.
sourceMoreMaps.Pmap Type
Pmap()
Maps concurrently over elements across multiple Julia processes using Distributed.pmap
.
Best for:
Very large arrays
Memory-intensive operations
Multi-machine clusters
Usage
julia> using MoreMaps # @everywhere
julia> C = Chart(Pmap())
Chart{MoreMaps.All, Pmap, NoProgress, NoExpansion}(Pmap(), NoProgress(), NoExpansion())
julia> data = [1, 2, 3, 4, 5];
julia> result = map(x -> x^2, C, data)
5-element Vector{Int64}:
1
4
9
16
25
julia> result = map(sum, Chart(Vector{Int}, Pmap()), [[1, 2], [3, 4], [5, 6]])
3-element Vector{Int64}:
3
7
11
Note: Use addprocs()
to add worker processes, and @everywhere to load MoreMaps
and any functions to be mapped. Functions and data are serialized across processes, which adds overhead.
See also: Sequential
, Threaded
, Chart
, map
MoreMaps.Sequential Type
Sequential()
A backend for sequential (single-threaded) execution. Maps one-at-a-time over elements of an array, in order Sequential
is the default Chart
backend.
Best for:
Small arrays
Operations with minimal computational cost
Debugging and development
Usage
julia> using MoreMaps
julia> C = Chart(Sequential())
Chart{MoreMaps.All, Sequential, NoProgress, NoExpansion}(Sequential(), NoProgress(), NoExpansion())
julia> C = Chart() # Defaults to `Sequential`
Chart{MoreMaps.All, Sequential, NoProgress, NoExpansion}(Sequential(), NoProgress(), NoExpansion())
julia> data = [1, 2, 3, 4, 5];
julia> result = map(x -> x^2, C, data)
5-element Vector{Int64}:
1
4
9
16
25
julia> nested_data = [[1, 2], [3, 4], [5, 6]]; # Works with nested arrays
julia> C_nested = Chart(Vector{Int}, Sequential());
julia> result = map(sum, C_nested, nested_data)
3-element Vector{Int64}:
3
7
11
See also: Threaded
, Chart
, map
MoreMaps.Threaded Type
Threaded()
Maps concurrently over elements of an array using Threads.@threads
.
Best for:
Medium to large arrays
Single-machine parallelism
Usage
julia> using MoreMaps
julia> C = Chart(Threaded())
Chart{MoreMaps.All, Threaded, NoProgress, NoExpansion}(Threaded(), NoProgress(), NoExpansion())
julia> data = [1, 2, 3, 4, 5];
julia> result = map(x -> x^2, C, data)
5-element Vector{Int64}:
1
4
9
16
25
julia> nested_data = [[1, 2], [3, 4], [5, 6]]; # Works with nested arrays
julia> C_nested = Chart(Vector{Int}, Threaded());
julia> result = map(sum, C_nested, nested_data)
3-element Vector{Int64}:
3
7
11
Note: Results may not be in deterministic order due to parallel execution. Use Sequential()
if order matters or for debugging. Performance depends on the number of threads available. Start Julia with julia -t auto
or set the JULIA_NUM_THREADS
environment variable.
See also: Sequential
, Chart
, map
MoreMaps.nsimilar Method
Construct a similar nested array to x
with new leaves of type outleaf, for original leaves of type inleaf
MoreMaps.Daggermap Type
Daggermap(; kwargs...)
Maps concurrently over elements of an array using Dagger.jl's task-based parallelism. Daggermap
creates a distributed computation graph that can execute across multiple processes and threads.
Best for:
Very large computations
Heterogeneous computing resources
Complex dependency graphs
Dynamic load balancing
Usage
julia> using MoreMaps, Dagger
julia> C = Chart(Daggermap())
Chart{MoreMaps.All, Daggermap, NoProgress, NoExpansion}(Daggermap(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}()), NoProgress(), NoExpansion())
julia> data = [1, 2, 3, 4, 5];
julia> result = map(x -> x^2, C, data)
5-element Vector{Int64}:
1
4
9
16
25
julia> nested_data = [[1, 2], [3, 4], [5, 6]]; # Works with nested arrays
julia> C_nested = Chart(Vector{Int}, Daggermap());
julia> result = map(sum, C_nested, nested_data)
3-element Vector{Int64}:
3
7
11
julia> C_opts = Chart(Daggermap(; single=1)); # Pass options to Dagger.@spawn
julia> result = map(x -> x + 10, C_opts, [1, 2, 3])
3-element Vector{Int64}:
11
12
13
Note: Uses Dagger.jl's task scheduling, which provides dynamic load balancing and can work across multiple processes. Tasks are spawned lazily and executed based on resource availability. The options
keyword arguments are passed to Dagger.@spawn
.
See also: Sequential
, Threaded
, Pmap
, Chart
, map
MoreMaps.TermLogger Type
TermLogger(nlogs::Int = 0; kwargs...)
A progress logger that creates rich terminal progress bars using Term.jl.
Arguments
nlogs::Int
: Number of update intervals for progress rendering (default: 0, which updates every iteration)kwargs...
: Additional keyword arguments passed toTerm.ProgressBar
Usage
julia> using MoreMaps, Term
julia> P = TermLogger(5);
julia> C = Chart(P);
julia> data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
julia> result = map(x -> (sleep(0.5); x^2), C, data); # Will display a progress bar
julia> result
10-element Vector{Int64}:
1
4
9
16
25
36
49
64
81
100
Note: Requires Term.jl to be loaded. Creates visual progress bars in the terminal with customizable appearance. Set nlogs = 0
for maximum update frequency, or higher values to reduce rendering overhead. The progress bar will be transient by default (disappears when complete). Once constructed, a re-used TermLogger
will accumulate progress bars from subsequent maps.
See also: LogLogger
, ProgressLogger
, NoProgress
, Chart
MoreMaps.ProgressLogger Method
ProgressLogger(nlogs::Int = 10; id = UUIDs.uuid4(), kwargs...)
A progress logger that integrates with the ProgressLogging.jl ecosystem. Combines LogLogger
functionality with ProgressLogging.jl's structured progress reporting. Useful for applications that need standardized progress reporting (e.g., Pluto.jl notebooks, IDEs).
Arguments
nlogs::Int
: Number of progress update intervals (default: 10)id
: Unique identifier for the progress logger (default: auto-generated UUID)kwargs...
: Additional keyword arguments passed toProgressLogging.Progress
Usage
julia> using MoreMaps, ProgressLogging
julia> P = ProgressLogger(5)
ProgressLogger(LogLogger(5), ProgressLogging.Progress(UUIDs.UUID("00000000-0000-0000-0000-000000000000"), "Progress", 1.0, false, :normal, 0, 1.0, Dict{String, Any}(), Any[]))
julia> C = Chart(P)
Chart{MoreMaps.All, Sequential, ProgressLogger, NoExpansion}(Sequential(), ProgressLogger(LogLogger(5), ProgressLogging.Progress(UUIDs.UUID("00000000-0000-0000-0000-000000000000"), "Progress", 1.0, false, :normal, 0, 1.0, Dict{String, Any}(), Any[])), NoExpansion())
julia> data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
julia> result = map(x -> x^2, C, data); # Will emit ProgressLogging.jl messages
julia> result
10-element Vector{Int64}:
1
4
9
16
25
36
49
64
81
100
julia> # Works with any backend
C_threaded = Chart(Threaded(), ProgressLogger(3));
Best with:
VSCode's progress indicator
Jupyter notebooks
Pluto.jl notebooks
Note: Requires ProgressLogging.jl to be loaded. Progress messages are emitted as structured logs that can be captured by compatible logging systems. Use LogLogger
for simple console output or NoProgress
to disable progress reporting entirely.
See also: LogLogger
, NoProgress
, Chart