MoreMaps.jl
A flexible mapping framework for Julia that provides different parallel backends, progress tracking, and iteration patterns.
Features
Multiple backends: Sequential, Threads, Distributed, and Dagger execution
Progress tracking: Support for various progress-logging backends
Nested array support: Map over specific leaf types in nested array structures
Cartesian expansions: Easy cartesian product iterations
Quick Start
using MoreMaps
# Basic usage with default sequential backend
x = rand(100)
C = Chart()
y = map(sqrt, C, x)
# Use threading for parallel execution
C_threaded = Chart(Threaded())
y_threaded = map(sqrt, C_threaded, x)
# Add progress tracking
C_progress = Chart(Threaded(), LogLogger(10))
y_progress = map(sqrt, C_progress, x)
100-element Vector{Float64}:
0.5254885290882129
0.8475736973719847
0.8051960669031756
0.9974847199361225
0.6295096013654823
0.5482719862175252
0.9006157783360864
0.6539170063711927
0.6111184200405134
0.7782274358212425
⋮
0.9836960749984547
0.7465732525092232
0.7257746980697865
0.5843321763161453
0.3497091284553465
0.08416433358896538
0.827186032449822
0.8838418178762875
0.7386407307199285
Basics
The basis of a MoreMaps
map is the Chart
type, which configures how mapping operations are executed.
A Chart
has the following fields:
backend
: Specifies the execution backendprogress
: Configures the progress logging behaviorleaf
: Defines the element type where recursion terminates, for mapping nested arraysexpansion
: Determines the expansion strategy (e.g. Cartesian product)
A chart can be constructed using keywords or arbitrary-order positional arguments. The default Chart()
reproduces Base.map()
, and is constructed as:
C = Chart(backend=Sequential(), # No parallel execution; similar to Base.map
progress=NoProgress(), # No progress logging
leaf=MoreMaps.All, # Map over each element of the root array, like Base.map
expansion=NoExpansion()) # Map over the original input arrays, as for Base.map
# Or
C = Chart(Sequential(), NoProgress(), MoreMaps.All, NoExpansion()) # In any order
# Default behavior
C == Chart()
Mapping
Once you have a Chart, pass it to the standard Base.map
function:
using MoreMaps
x = rand(10)
C = Chart()
y = map(sqrt, C, x)
y == map(sqrt, x)
true
See the following pages for details on configuring a Chart
:
Backends - Execution strategies (Sequential, Threaded, Distributed, Dagger)
Progress - Progress tracking options
Leaves - Nested array handling
Expansions - Cartesian product iterations