Informations générales
This commit is contained in:
69
README.md
69
README.md
@@ -1,2 +1,67 @@
|
|||||||
Le [journal](journal.org) contient un bref résumé de notre progression à travers
|
# Programmation Synchrone 2025-2026 (M2 Info & EIDD)
|
||||||
les notes de cours, ainsi que quelques informations logistiques.
|
|
||||||
|
## Présentation
|
||||||
|
|
||||||
|
Le [syllabus](cours/syllabus-progsync.pdf) (résumé) du module est disponible.
|
||||||
|
|
||||||
|
### Contenu et objectifs
|
||||||
|
|
||||||
|
Le module de *Programmation synchrone* propose une introduction à la
|
||||||
|
programmation des **systèmes réactifs** par le biais de langages spécialisés,
|
||||||
|
les **langages synchrones**.
|
||||||
|
|
||||||
|
- Les **systèmes réactifs** sont des systèmes informatiques en interaction
|
||||||
|
continue avec un environnement extérieur. Le pilote automatique d'un avion
|
||||||
|
moderne (_fly-by-wire_), le contrôleur d'une machine à laver, ou le logiciel
|
||||||
|
de commande d'un ascenseur constituent des exemples de systèmes réactifs.
|
||||||
|
|
||||||
|
- Les **langages synchrones** sont des langages spécialement conçus pour la
|
||||||
|
programmation des systèmes réactifs. Ils offrent une expressivité élevée tout
|
||||||
|
en garantissant statiquement certaines propriétés de sûreté. Leur usage est
|
||||||
|
désormais routinier dans les tâches conception et de développement dans
|
||||||
|
certains secteurs industriels, comme l'avionique ou le ferroviaire.
|
||||||
|
|
||||||
|
L'enseignement des langages synchrones vise deux objectifs. D'abord, **renforcer
|
||||||
|
vos compétences de programmation**, en vous faisant découvrir une famille de
|
||||||
|
langages à la fois originaux et utilisés dans l'industrie. Ensuite, **enrichir
|
||||||
|
votre culture scientifique**, en illustrant comment les systèmes réactifs
|
||||||
|
fournissent un exemple de point de jonction entre l'informatique et d'autres
|
||||||
|
disciplines comme l'automatique ou le traitement du signal.
|
||||||
|
|
||||||
|
Pour atteindre ces objectifs, on utilisera le langage universitaire
|
||||||
|
[*Heptagon*](https://gitlab.inria.fr/synchrone/heptagon), aussi bien durant le
|
||||||
|
cours magistral, pour illustrer les principes généraux des langages synchrones,
|
||||||
|
que durant les séances de travaux pratiques. Les autres langages synchrones
|
||||||
|
(notamment d'origines industrielles) seront aussi régulièrement évoqués durant
|
||||||
|
le cours.
|
||||||
|
|
||||||
|
## Organisation du cours
|
||||||
|
|
||||||
|
Le cours magistral a lieu le *lundi de 10h45 à 12h45*, dans la salle 1009 du
|
||||||
|
bâtiment Sophie Germain.
|
||||||
|
|
||||||
|
Les séances de travaux pratiques ont lieu en salle 2003 du bâtiment Sophie
|
||||||
|
Germain, avec deux groupes disponibles :
|
||||||
|
|
||||||
|
- le *mardi de 10h45 à 12h45*,
|
||||||
|
|
||||||
|
- le *jeudi de 08h30 à 10h30*.
|
||||||
|
|
||||||
|
Nous vous demandons **d'apporter votre ordinateur portable**.
|
||||||
|
|
||||||
|
## Modalités de contrôle des connaissances
|
||||||
|
|
||||||
|
La note du cours sera composée pour 50% de celle du projet et pour 50% de celle
|
||||||
|
de l'examen final. Les cours de master 2 n'offrent pas de deuxième session.
|
||||||
|
|
||||||
|
## Organisation de ce dépôt
|
||||||
|
|
||||||
|
Ce dépôt contiendra tout le matériel pédagogique du cours :
|
||||||
|
|
||||||
|
- le **support du cours**, dans les sous-répertoire [cours](cours/) et surtout
|
||||||
|
[notes](notes/),
|
||||||
|
|
||||||
|
- les **énoncés de TP**, dans le sous-répertoire [TP](tp/),
|
||||||
|
|
||||||
|
- l'**énoncé du projet, ainsi que son squelette**, seront ultérieurement
|
||||||
|
disponibles dans le sous-répertoire [projet](projet/).
|
||||||
|
|||||||
2
cours/README.md
Normal file
2
cours/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Le [journal](journal.org) contient un bref résumé de notre progression à travers
|
||||||
|
les notes de cours, ainsi que quelques informations logistiques.
|
||||||
12
cours/journal.org
Normal file
12
cours/journal.org
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#+TITLE: Programmation synchrone 2025/2026 -- Journal du cours
|
||||||
|
#+AUTHOR: Adrien Guatto
|
||||||
|
#+EMAIL: guatto@irif.org
|
||||||
|
#+LANGUAGE: fr
|
||||||
|
#+OPTIONS: ^:nil p:nil
|
||||||
|
#+LATEX_CLASS: article
|
||||||
|
#+LATEX_CLASS_OPTIONS: [a4paper,11pt]
|
||||||
|
#+LATEX_HEADER: \usepackage{a4wide}
|
||||||
|
#+LATEX_HEADER: \usepackage{microtype}
|
||||||
|
#+LATEX_HEADER: \hypersetup{hidelinks}
|
||||||
|
#+LATEX_HEADER: \usepackage[french]{babel}
|
||||||
|
# (org-latex-export-to-pdf)
|
||||||
BIN
cours/syllabus.pdf
Normal file
BIN
cours/syllabus.pdf
Normal file
Binary file not shown.
163
tools/hept
Executable file
163
tools/hept
Executable file
@@ -0,0 +1,163 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
|
||||||
|
VERBOSE=0
|
||||||
|
MAXSTEP=0
|
||||||
|
|
||||||
|
binary_exists() {
|
||||||
|
if ! command -v $1 &> /dev/null
|
||||||
|
then
|
||||||
|
cat <<EOF
|
||||||
|
Command "$1" could not be found in \$PATH.
|
||||||
|
Hint: $2
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
cat <<EOF >&2
|
||||||
|
Usage: $0 [OPTIONS] file.ept
|
||||||
|
Options:
|
||||||
|
-s <node_name> Simulate node <node_name>
|
||||||
|
-t Simulate in text mode
|
||||||
|
-g Simulate in graphical mode (hepts)
|
||||||
|
-m <maximum> Stop after <maximum> steps in text mode
|
||||||
|
-c Check for required tools and terminate
|
||||||
|
-v Print internal information
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
info() {
|
||||||
|
if [ $VERBOSE -ne 0 ]; then echo $1; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
warn() {
|
||||||
|
echo -e "\e[93m$1\e[0m" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo -e "\e[31m$1\e[0m" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd() {
|
||||||
|
if [ $VERBOSE -ne 0 ]; then echo $1; fi
|
||||||
|
command $1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Entry point
|
||||||
|
|
||||||
|
VERBOSE=0
|
||||||
|
if ! command -v hepts &> /dev/null
|
||||||
|
then
|
||||||
|
GRAPHICAL=0
|
||||||
|
else
|
||||||
|
GRAPHICAL=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
NODES=""
|
||||||
|
|
||||||
|
while getopts "cvs:htgm:" OPT
|
||||||
|
do
|
||||||
|
case "${OPT}" in
|
||||||
|
v)
|
||||||
|
VERBOSE=1
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
NODES="${NODES} ${OPTARG}"
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
GRAPHICAL=0
|
||||||
|
;;
|
||||||
|
g)
|
||||||
|
GRAPHICAL=1
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
binary_exists "realpath" "brew install coreutils"
|
||||||
|
binary_exists "gcc" "use the package manager of your Linux distro"
|
||||||
|
binary_exists "heptc" "opam install heptagon"
|
||||||
|
binary_exists "hepts" "opam install lablgtk heptagon"
|
||||||
|
echo "All tools seem to be available, $0 ready to run simulations"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
m)
|
||||||
|
MAXSTEP=$(expr ${OPTARG})
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
help
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]
|
||||||
|
then
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $GRAPHICAL -eq 1 ]
|
||||||
|
then
|
||||||
|
binary_exists "hepts" "opam install lablgtk heptagon"
|
||||||
|
fi
|
||||||
|
binary_exists "heptc" "opam install heptagon"
|
||||||
|
binary_exists "gcc" "use the package manager of your Linux distro"
|
||||||
|
binary_exists "realpath" "brew install coreutils"
|
||||||
|
|
||||||
|
CDIR=`pwd`
|
||||||
|
FILE=$1
|
||||||
|
TMPDIR=`mktemp -d`
|
||||||
|
BASENAME=`basename $1 .ept`
|
||||||
|
MOD="$(tr '[:lower:]' '[:upper:]' <<< ${BASENAME:0:1})${BASENAME:1}"
|
||||||
|
BIN=$BASENAME.bin
|
||||||
|
|
||||||
|
info "Entering temporary dir $TMPDIR"
|
||||||
|
|
||||||
|
cp $FILE $TMPDIR
|
||||||
|
cd $TMPDIR
|
||||||
|
|
||||||
|
if [ "$NODES" = "" ]; then
|
||||||
|
warn "No node specified. In $FILE, there is:"
|
||||||
|
egrep -oh '(node|fun) *(\w+)' "$FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for NODE in $NODES
|
||||||
|
do
|
||||||
|
info "Simulating node $NODE in $FILE"
|
||||||
|
|
||||||
|
if [ $GRAPHICAL -eq 1 ]
|
||||||
|
then
|
||||||
|
cmd "heptc -target c -s $NODE -hepts $FILE"
|
||||||
|
else
|
||||||
|
cmd "heptc -target c -s $NODE $FILE"
|
||||||
|
fi
|
||||||
|
if [ $? -ne 0 ]; then exit 1; fi
|
||||||
|
|
||||||
|
DIRN=${BASENAME//-/lex45_}_c
|
||||||
|
[ -d ${DIRN} ] || die "Could not find directory ${DIRN}"
|
||||||
|
|
||||||
|
cd ${DIRN}
|
||||||
|
cmd "gcc -I `heptc -where`/c *.c -o ../$BIN"
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
die "Could not compile the generated C code in $TMPDIR"
|
||||||
|
fi
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
info "Running simulation of $NODE"
|
||||||
|
|
||||||
|
if [ $GRAPHICAL -eq 1 ]
|
||||||
|
then
|
||||||
|
cmd "hepts -mod $MOD -node $NODE -exec "`realpath $TMPDIR/$BIN`""
|
||||||
|
else
|
||||||
|
cmd "`realpath $TMPDIR/$BIN` ${MAXSTEP}"
|
||||||
|
fi
|
||||||
|
if [ $? -ne 0 ]; then die "Could not simulate node $NODE"; fi
|
||||||
|
done
|
||||||
|
info "Finished simulation"
|
||||||
26
tools/hept-plot
Executable file
26
tools/hept-plot
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os, sys, tempfile
|
||||||
|
|
||||||
|
try:
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
except ImportError as e:
|
||||||
|
print("You need to install the Python packages matplotlib and pandas")
|
||||||
|
print("e.g., `pip install --user matplotlib pandas`")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
(_, tracefile) = tempfile.mkstemp(suffix = ".csv")
|
||||||
|
print("hept-plot: saving trace to {}".format(tracefile))
|
||||||
|
os.system("HEPT_TRACE=\"{}\" {}".format(tracefile, " ".join(sys.argv[1:])))
|
||||||
|
|
||||||
|
try:
|
||||||
|
trace = pd.read_csv(tracefile)
|
||||||
|
trace = trace.loc[:, ~trace.columns.str.contains('^Unnamed')]
|
||||||
|
trace.plot(kind = 'line')
|
||||||
|
plt.legend(loc = 'upper left')
|
||||||
|
plt.show()
|
||||||
|
except pd.errors.EmptyDataError:
|
||||||
|
print("hept-plot: nothing to plot")
|
||||||
|
sys.exit(0)
|
||||||
Reference in New Issue
Block a user