Skip to content
Closed
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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ jobs:
LDPC_MAX_LATENCY_NS: 1000
run: ./build/ldpc_benchmark

- name: Run Monte-Carlo FER simulation
shell: bash
run: |
set -euo pipefail
trials="${MONTE_CARLO_TRIALS:-10000}"
./build/monte_carlo_sim --trials "${trials}" --csv fer_curve.csv

- name: Upload Monte-Carlo FER curve
uses: actions/upload-artifact@v4
with:
name: qldpc-fer-curve
if-no-files-found: error
retention-days: 30
path: fer_curve.csv

hardware-bitstream-build:
# Ne jamais exécuter du code d’une pull request externe sur un runner local.
if: github.event_name != 'pull_request'
Expand Down
33 changes: 32 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ FetchContent_MakeAvailable(ldpc)
option(BUILD_UNIT_TESTS "Build Catch2 unit tests" ON)
option(BUILD_AXI_DMA_DRIVER "Build the Linux ARM AXI-DMA driver" OFF)
option(BUILD_HIL_BENCHMARK "Build the hardware-in-the-loop benchmark" OFF)
option(BUILD_MONTE_CARLO_SIM "Build the Monte-Carlo FER simulator" ON)
if(BUILD_UNIT_TESTS OR BUILD_MONTE_CARLO_SIM)
enable_testing()
endif()
if(BUILD_AXI_DMA_DRIVER)
if(NOT UNIX)
message(FATAL_ERROR "BUILD_AXI_DMA_DRIVER requires a Unix-like target")
Expand All @@ -49,11 +53,13 @@ if(BUILD_UNIT_TESTS)
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(Catch2)
enable_testing()
endif()

add_executable(qldpc_decoder main.cpp)
add_executable(ldpc_benchmark benchmark.cpp)
if(BUILD_MONTE_CARLO_SIM)
add_executable(monte_carlo_sim monte_carlo.cpp)
endif()

if(BUILD_UNIT_TESTS)
add_executable(unit_tests tests/test_decoder.cpp)
Expand All @@ -62,6 +68,17 @@ if(BUILD_UNIT_TESTS)
add_test(NAME unit_tests COMMAND unit_tests)
endif()

if(BUILD_MONTE_CARLO_SIM)
add_test(
NAME monte_carlo_smoke
COMMAND monte_carlo_sim
--trials 50
--ber-list 0.01
--csv ${CMAKE_BINARY_DIR}/fer_curve_test.csv
--progress-interval 50
)
endif()

target_link_libraries(qldpc_decoder
PRIVATE
ldpc
Expand All @@ -74,12 +91,26 @@ target_link_libraries(ldpc_benchmark
OpenMP::OpenMP_CXX
)

if(BUILD_MONTE_CARLO_SIM)
target_link_libraries(monte_carlo_sim
PRIVATE
ldpc
OpenMP::OpenMP_CXX
)
endif()

target_include_directories(qldpc_decoder PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ldpc_benchmark PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(BUILD_MONTE_CARLO_SIM)
target_include_directories(monte_carlo_sim PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
endif()

if(NOT MSVC)
set_property(TARGET qldpc_decoder PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
set_property(TARGET ldpc_benchmark PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
if(BUILD_MONTE_CARLO_SIM)
set_property(TARGET monte_carlo_sim PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if(BUILD_UNIT_TESTS)
set_property(TARGET unit_tests PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ Le projet construit également `ldpc_benchmark`, qui mesure une multiplication m

Dans GitHub Actions, le benchmark échoue si la médiane atteint ou dépasse `1000 ns` (`1 µs`). Le seuil peut être changé avec la variable d’environnement `LDPC_MAX_LATENCY_NS`. Les runners GitHub-hosted étant virtualisés et partagés, le résultat est un contrôle de régression indicatif et ne remplace pas une mesure sur machine dédiée.

## Simulation Monte-Carlo FER

Le binaire `monte_carlo_sim` exécute une simulation Monte-Carlo de taux d’erreur trame (FER) sur plusieurs points BER et exporte la courbe en CSV (`BER,FER,FramesAtBER,ErrorsAtBER,Timestamp`).

```bash
./build/monte_carlo_sim --trials 10000 --csv fer_curve.csv
```

Options utiles :
- `--ber-list 0.001,0.005,0.01,0.02,0.05`
- `--seed 42`
- `--json fer_curve.json` (export optionnel)

Le CSV conserve volontairement le schéma compact requis (`BER,FER,FramesAtBER,ErrorsAtBER,Timestamp`). L’erreur standard et l’intervalle de confiance à 95 % sont affichés en console et inclus dans l’export JSON optionnel.

Dans la CI logicielle, la simulation est lancée avec `MONTE_CARLO_TRIALS` (défaut: `10000`) et publie `fer_curve.csv` comme artefact.

La première configuration télécharge automatiquement le dépôt amont `quantumgizmos/ldpc` dans le répertoire de build. Le fichier `CMakeLists.txt` utilise `-O3 -march=native -ffast-math -flto` sur les compilateurs non-MSVC et `/O2 /arch:AVX2` sous MSVC.

> `-march=native` produit un binaire adapté à la machine de compilation. Pour distribuer le binaire sur d’autres processeurs, remplacez ce drapeau par une architecture cible portable.
Expand Down
Loading