Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ jobs:
run: |
cmake -S . -B build/sanitizers -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DSMARTPARALLEL_BUILD_VISION=ON \
-DSMARTPARALLEL_ENABLE_OPENCV_PROVIDER=OFF \
-DSMARTPARALLEL_BUILD_VALIDATION=ON \
-DSMARTPARALLEL_BUILD_BENCHMARKS=OFF \
-DSMARTPARALLEL_BUILD_REAL_WORLD_BENCHMARKS=OFF \
Expand All @@ -285,3 +287,63 @@ jobs:

- name: Run sanitizer correctness tests
run: ctest --test-dir build/sanitizers --output-on-failure --parallel 1

native-vision:
name: linux-clang-release-native-vision
runs-on: ubuntu-latest
timeout-minutes: 25
env:
CC: clang
CXX: clang++
steps:
- name: Check out SmartParallel
uses: actions/checkout@v4

- name: Configure native vision validation
run: |
cmake -S . -B build/native-vision -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DSMARTPARALLEL_BUILD_VISION=ON \
-DSMARTPARALLEL_ENABLE_OPENCV_PROVIDER=OFF \
-DSMARTPARALLEL_BUILD_VALIDATION=ON \
-DSMARTPARALLEL_BUILD_BENCHMARKS=OFF \
-DSMARTPARALLEL_ENABLE_TBB=OFF \
-DSMARTPARALLEL_INSTALL=ON \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/native-vision-install

- name: Build and test native vision
run: |
cmake --build build/native-vision --parallel 2
ctest --test-dir build/native-vision --output-on-failure --parallel 2
cmake --install build/native-vision

- name: Configure installed vision consumer
run: |
cmake -S tests/package-consumer-vision -B build/native-vision-consumer -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/build/native-vision-install

- name: Build installed vision consumer
run: cmake --build build/native-vision-consumer --parallel 2

- name: Run installed vision consumer
run: ctest --test-dir build/native-vision-consumer --output-on-failure

documentation:
name: documentation-and-release-evidence
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out SmartParallel
uses: actions/checkout@v4

- name: Validate documentation, release metadata, and accepted evidence
run: python3 tools/check_documentation.py

- name: Validate Python publication tools
run: |
python3 -m py_compile \
tools/analyze_v15_adaptive_routes.py \
tools/generate_v15_benchmark_plots.py \
tools/publish_v15_benchmark_docs.py \
tools/check_documentation.py
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ Thumbs.db
build_*/

# Generated benchmark and documentation artifacts
# The final v1.1 real-world CSV/Markdown results are intentionally versioned.
# Accepted release evidence is published under docs/*/assets; local validation output stays ignored.
validation/output/*.csv
!validation/output/v1.4.0_parallel_algorithms.csv
!validation/output/v1.4.0_parallel_algorithms_raw.csv
validation/output/v1.5.0_adaptive_routes/
validation/output/plots/
docs/generated/

Expand Down
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,56 @@

All notable public changes to SmartParallel are documented here. Detailed internal milestone history is retained in [`docs/archive/v1.1-development/CHANGELOG_DEVELOPMENT_HISTORY.md`](docs/archive/v1.1-development/CHANGELOG_DEVELOPMENT_HISTORY.md).

## [1.5.0] — Adaptive execution routes

### Added

- Optional semantic vision module exported separately as `SmartParallel::vision` through the `SmartParallelVision` CMake package.
- `smart::vision::threshold` with exact one-channel `uint8_t` Binary and BinaryInverse semantics over contiguous, strided, disjoint, or exact in-place image views.
- Automatic complete-route selection across Native Sequential, Native ThreadPool, Native oneTBB, and optional OpenCV `cv::threshold`; Native StaticThread remains forceable for diagnostics.
- Bounded sharded route learning with two priming calls, balanced successive elimination, adaptive 3–11 sample windows, median/MAD bounds, independent winner holdout, conservative equivalent-route preference, single-flight probing, and bounded profile retention.
- Sparse performance-drift sentinels and four-invocation current-context ABBA revalidation, allowing a stable profile to replace an earlier winner when current runtime conditions change.
- Runtime-selected AVX2, SSE2, and portable branchless Native threshold kernels shared by every Native scheduler route.
- Zero-copy OpenCV `cv::Mat` views, provider build/runtime fingerprinting, cached provider state, and explicit `refresh_provider_state()` invalidation.
- Thread-local stable-route hot dispatch and operation diagnostics covering route, cache, learning, holdout, drift, revalidation, participants, chunks, timing state, and authentication.
- Route-training telemetry with training/current baselines, per-route statistics, holdout evidence, latest current-context comparison, and route-switch count.
- Deterministic validation for exact semantics, SIMD paths, route learning, noisy/outlier inputs, holdout reversal, distribution shift, concurrency, nested fallback, package consumption, and publication probe isolation.
- Proof-driven publication workflow with identical memory for every route, an independent sequential oracle, balanced deployment and steady-state orders, batched adjacent ABBA/BAAB dispatch measurement, raw schema v6, learning schema v2, Markdown/CSV evidence, and dependency-free SVG figures.
- Release documentation with accepted results, methodology, environment metadata, source hashes, generated benchmark assets, and a focused `v15_adaptive_threshold` example.

### Changed

- Extended SmartParallel from scheduler selection alone to complete-implementation selection for recognized semantic operations, without changing `IExecutionBackend` or the v1.4 generic algorithms.
- Stable Auto calls now use a compact exact thread-local key before full provider/profile construction and remain timer-free except for sparse drift sentinels.
- Equivalent route choices prefer Native Sequential, then Native parallel routes, then external providers when measured differences remain inside the configured equivalence band.
- The publication workflow learns under repeated calls, adapts under a balanced interleaved deployment regime, waits for a clean settled streak, and pauses maintenance only for the final timed matrix.

### Compatibility

- Existing `parallel_for` and v1.4 algorithm APIs are unchanged.
- The core `SmartParallel::smart_parallel` package remains independent of OpenCV and the vision module.
- OpenCV and `SmartParallel::vision` remain opt-in.
- Native-only builds provide the same public threshold API with OpenCV excluded from the candidate set.

### Accepted validation

- Complete deterministic suite: **18/18 passed**.
- Accepted Windows/MSVC publication: **2,238 correct and authenticated samples**.
- Route selection: **6/6 passed**.
- Native kernel versus independent oracle: **6/6 passed**.
- Stable Auto dispatch: **6/6 passed**.
- Combined release gate: **6/6 passed**.
- Recorded machine: 16 logical threads, SmartParallel worker budget 16, OpenCV 4.12.0, OpenCL disabled, authenticated AVX2 Native kernel.
- Auto achieved a **1.16× geometric-mean speedup over the independent sequential loop** and **1.48× over direct OpenCV** on the recorded machine.
- The two 1080p profiles initially selected OpenCV, detected a changed deployment regime, and switched once to Native Sequential using current-context evidence.
- Clang warnings-as-errors, ASan/UBSan, Native-only and OpenCV-enabled package consumers, core dependency isolation, and the retained v1.4 smoke matrix passed.

### Limitations

- v1.5 begins with one semantic operation; arbitrary `parallel_transform` lambdas remain Native-only because equivalence to a specialized provider cannot be proven safely.
- Route learning is in-process and root-only. Persistent operation profiles and coordinated external-runtime participant leasing remain future work.
- Performance choices and speedups are machine-specific.

## [1.4.0] — Parallel algorithm expansion

### Added
Expand Down Expand Up @@ -122,6 +172,7 @@ All notable public changes to SmartParallel are documented here. Detailed intern
- Added ThreadPool, StaticThread, oneTBB, and sequential execution paths.
- Added bounded runtime experience, diagnostics, validation programs, and the original OpenCV/scientific benchmark suite.

[1.5.0]: docs/v1.5/release-notes.md
[1.4.0]: docs/v1.4/release-notes.md
[1.3.0]: docs/v1.3/release-notes.md
[1.1.0]: docs/v1.1/release-notes.md
Expand Down
88 changes: 86 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ endif()

project(
SmartParallel
VERSION 1.4.0
DESCRIPTION "Adaptive parallel scheduling for modern C++"
VERSION 1.5.0
DESCRIPTION "Adaptive parallel execution for modern C++"
LANGUAGES CXX
)

Expand Down Expand Up @@ -78,6 +78,16 @@ option(SMARTPARALLEL_BUILD_V140_ALGORITHM_VALIDATION
"Build v1.4 parallel algorithm correctness validation" OFF)
option(SMARTPARALLEL_BUILD_V140_ALGORITHM_BENCHMARKS
"Build v1.4 parallel algorithm benchmark suite" OFF)
option(SMARTPARALLEL_BUILD_VISION
"Build the v1.5 semantic vision operation module" OFF)
option(SMARTPARALLEL_ENABLE_OPENCV_PROVIDER
"Enable the optional OpenCV vision execution route" OFF)
option(SMARTPARALLEL_REQUIRE_OPENCV_PROVIDER
"Fail configuration when the requested OpenCV provider is unavailable" OFF)
option(SMARTPARALLEL_BUILD_V150_VISION_VALIDATION
"Build v1.5 adaptive execution-route correctness validation" OFF)
option(SMARTPARALLEL_BUILD_V150_VISION_BENCHMARKS
"Build v1.5 adaptive execution-route benchmark suite" OFF)
option(SMARTPARALLEL_BUILD_SCIENTIFIC_TEST1
"Build scientific Test 1: numerical integration" OFF)
option(SMARTPARALLEL_BUILD_SCIENTIFIC_TEST2
Expand All @@ -101,6 +111,10 @@ option(SMARTPARALLEL_BUILD_PARTICLE_BENCHMARK
option(SMARTPARALLEL_REQUIRE_REAL_WORLD_DEPENDENCIES
"Fail configuration when a requested real-world dependency is unavailable" OFF)

if(SMARTPARALLEL_ENABLE_OPENCV_PROVIDER)
set(SMARTPARALLEL_BUILD_VISION ON)
endif()

include(SmartParallelOptions)
include(SmartParallelHelpers)

Expand All @@ -127,6 +141,26 @@ endif()

add_subdirectory(src)

set(SMARTPARALLEL_VISION_HAS_OPENCV 0)
if(SMARTPARALLEL_ENABLE_OPENCV_PROVIDER)
find_package(OpenCV CONFIG QUIET COMPONENTS core imgproc)
if(NOT OpenCV_FOUND)
find_package(OpenCV QUIET COMPONENTS core imgproc)
endif()
if(OpenCV_FOUND)
set(SMARTPARALLEL_VISION_HAS_OPENCV 1)
elseif(SMARTPARALLEL_REQUIRE_OPENCV_PROVIDER)
message(FATAL_ERROR
"SMARTPARALLEL_REQUIRE_OPENCV_PROVIDER=ON but OpenCV core/imgproc was not found")
else()
message(WARNING "OpenCV was not found; the v1.5 vision module will use native routes only")
endif()
endif()

if(SMARTPARALLEL_BUILD_VISION)
add_subdirectory(vision)
endif()

if(SMARTPARALLEL_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
Expand All @@ -146,6 +180,7 @@ if(SMARTPARALLEL_INSTALL)
DIRECTORY include/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT Development
PATTERN "smart/vision" EXCLUDE
)

install(
Expand Down Expand Up @@ -194,4 +229,53 @@ if(SMARTPARALLEL_INSTALL)
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SmartParallel"
COMPONENT Development
)

if(SMARTPARALLEL_BUILD_VISION)
install(
DIRECTORY include/smart/vision/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/smart/vision"
COMPONENT Development
)

install(
TARGETS smart_parallel_vision
EXPORT SmartParallelVisionTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT Runtime
NAMELINK_COMPONENT Development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT Development
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/SmartParallelVisionConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/SmartParallelVisionConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SmartParallelVision"
)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/SmartParallelVisionConfigVersion.cmake"
VERSION "${PROJECT_VERSION}"
COMPATIBILITY SameMajorVersion
)

install(
EXPORT SmartParallelVisionTargets
FILE SmartParallelVisionTargets.cmake
NAMESPACE SmartParallel::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SmartParallelVision"
COMPONENT Development
)

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/SmartParallelVisionConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/SmartParallelVisionConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SmartParallelVision"
COMPONENT Development
)
endif()
endif()
30 changes: 30 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,25 @@
"SMARTPARALLEL_ENABLE_SANITIZERS": "ON",
"SMARTPARALLEL_INSTALL": "OFF"
}
},
{
"name": "v15-adaptive-routes",
"displayName": "v1.5 Adaptive Execution Routes Release validation",
"inherits": "release",
"binaryDir": "${sourceDir}/build/v15-adaptive-routes",
"cacheVariables": {
"VCPKG_MANIFEST_FEATURES": "vision-opencv",
"SMARTPARALLEL_BUILD_VISION": "ON",
"SMARTPARALLEL_ENABLE_OPENCV_PROVIDER": "ON",
"SMARTPARALLEL_REQUIRE_OPENCV_PROVIDER": "ON",
"SMARTPARALLEL_BUILD_VALIDATION": "ON",
"SMARTPARALLEL_BUILD_V150_VISION_VALIDATION": "ON",
"SMARTPARALLEL_BUILD_V150_VISION_BENCHMARKS": "ON",
"SMARTPARALLEL_BUILD_BENCHMARKS": "OFF",
"SMARTPARALLEL_ENABLE_TBB": "ON",
"SMARTPARALLEL_REQUIRE_TBB": "ON",
"SMARTPARALLEL_INSTALL": "ON"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -155,6 +174,10 @@
{
"name": "ci-sanitizers",
"configurePreset": "ci-sanitizers"
},
{
"name": "v15-adaptive-routes",
"configurePreset": "v15-adaptive-routes"
}
],
"testPresets": [
Expand Down Expand Up @@ -199,6 +222,13 @@
"output": {
"outputOnFailure": true
}
},
{
"name": "v15-adaptive-routes",
"configurePreset": "v15-adaptive-routes",
"output": {
"outputOnFailure": true
}
}
]
}
Loading
Loading