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.6335697448105473
0.5231538314906322
0.3183857303769386
0.6213351065770732
0.6868870713547407
0.35322354182720406
0.392318669516467
0.8462473733284664
0.2488385615983557
0.5175901260419997
⋮
0.5110883860429979
0.5507122658149486
0.7537018501265244
0.96943783813879
0.6236373260952588
0.9612657557665225
0.22491518330970867
0.36416175051516647
0.6977032011755038
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