These are some cut and paste examples for the usage of Siconos with Guix through the Guix HPC channel.
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -q -N $addr/channels/siconos-2023-03-06.scm && \
guix time-machine -C siconos-2023-03-06.scm -- \
shell --pure \
gcc-toolchain cmake make \
coreutils grep dash \
[email protected] [email protected] -- \
dash -c '
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
bdir=$tutorials/examples/mechanics/BouncingBall
cp $bdir/BouncingBallTS.ref .
siconos $bdir/BouncingBallTS.cpp'
addr=https://raw.githubusercontent.com/siconos/guix-siconos
wget -N $addr/channels/siconos-2023-03-06.scm && \
guix time-machine -C siconos-2023-03-06.scm -- \
shell --pure \
python python-numpy python-matplotlib python-packaging \
[email protected] [email protected] dash coreutils sed -- \
dash -c '
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
bdir=$tutorials/examples/mechanics/BouncingBall
sed "/matplotlib.use.*/a else:\n matplotlib.use(\"TkAgg\")" \
$bdir/BouncingBallTS.py | python3'
addr=https://raw.githubusercontent.com/siconos/guix-siconos
wget -N $addr/channels/siconos-2023-03-06.scm && \
guix time-machine -C siconos-2023-03-06.scm -- \
shell --pure \
[email protected] siconos-tutorials dash -- \
dash -c '
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
siconos $tutorials/examples/mechanics/GeometricPrimitives/cube.py'
addr=https://raw.githubusercontent.com/siconos/guix-siconos
wget -N $addr/channels/siconos-2023-03-06.scm && \
guix time-machine -C siconos-2023-03-06.scm -- \
environment --pure --ad-hoc \
vtk siconos -- \
siconos_vview cube.hdf5
An example of a slider crank with Open Cascade
contactors. The computation is done with a previous version of Siconos
([email protected]
) and a specific commit on siconos-tutorials:
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -N $addr/channels/siconos-2023-03-06.scm && \
guix time-machine -C siconos-2023-03-06.scm -- \
environment \
--with-git-url=siconos-tutorials=https://github.com/siconos/siconos-tutorials \
--with-commit=siconos-tutorials=7e1322d1c51224970967e46408b81a84e81b18a8 \
--pure --ad-hoc \
[email protected] siconos-tutorials python pythonocc dash coreutils cmake make gcc-toolchain@7 sed -- \
dash -c '
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
cp -r $tutorials/examples/mechanics/OCC_Examples .
cp -r $tutorials/examples/mechanics/Mechanisms .
cd OCC_Examples
sed -i "s/with_timer=True/with_timer=False/" occ_slider_crank.py
siconos occ_slider_crank.py'
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -N $addr/channels/siconos-2023-03-06.scm && \
guix time-machine -C siconos-2023-03-06.scm -- \
environment --pure --ad-hoc \
pythonocc vtk [email protected] dash -- dash -c '\
cd OCC_Examples && \
siconos_vview --cf-scale=0.05 occ_slider_crank.hdf5'
An example with transformations on siconos-tutorials
and siconos
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -q -N $addr/channels/siconos-2021-06-08.scm && \
guix time-machine -C siconos-2021-06-08.scm -- \
environment \
[email protected]:vacary/siconos-tutorials \
--with-branch=siconos-tutorials=stress_tests \
[email protected]:vacary/siconos \
--with-branch=siconos=optimize_2d_granular \
--pure --ad-hoc gcc-toolchain cmake make grep coreutils dash \
siconos siconos-tutorials -- \
dash -c '
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
siconos $tutorials/examples/mechanics/2DRigidBodies/Disks_stress_test.cpp'
To check code before commit, there is the --with-source
option:
git clone --depth 1 [email protected]:siconos/siconos &&
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -N $addr/channels/siconos-2021-05-05.scm && \
guix time-machine -C siconos-2021-05-05.scm -- \
environment --pure --ad-hoc siconos \
--with-source=siconos=/tmp/siconos -- siconos --help
This may be needed for debug through gdb and when modifying by hand the installation is convenient. Otherwise, it is preferable to use the transformations on repositories described above as they can be included in scripts.
The siconos
package is placed before --ad-hoc
option in order to
provide the necessary inputs
packages:
git clone --depth 1 [email protected]:siconos/siconos &&
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -N $addr/channels/siconos-2021-05-05.scm && \
guix time-machine -C siconos-2021-05-05.scm -- \
environment siconos --pure --ad-hoc dash -- \
dash -c 'mkdir -p siconos-build &&
cd siconos-build &&
cmake ../siconos -DWITH_BULLET=1 \
-DCMAKE_INSTALL_PREFIX=/tmp/install-siconos &&
make -j8 &&
make install'
With an installation from a direct compilation, the shebang part of
siconos
script has not been replaced. It points to local system and
not into the /gnu/store
. To avoid the usage of the wrong python
interpreter, it is necessary to call the siconos
script with the
python3
executable of the python
package:
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -N $addr/channels/siconos-2021-06-08.scm && \
guix time-machine -C siconos-2021-06-08.scm -- \
environment --pure --ad-hoc \
[email protected] \
cmake make gcc-toolchain \
python python-packaging \
dash coreutils -- \
dash -c '
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/install-siconos/lib &&
export PYTHONPATH=$PYTHONPATH:/tmp/install-siconos/lib/python3.8/site-packages
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
cp $tutorials/examples/mechanics/BouncingBall/BouncingBallTS.ref .
python3 /tmp/install-siconos/bin/siconos \
$tutorials/examples/mechanics/BouncingBall/BouncingBallTS.cpp'
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -N $addr/channels/siconos-2021-06-08.scm && \
guix time-machine -C siconos-2021-06-08.scm -- \
environment --pure --ad-hoc [email protected] \
dash python python-numpy python-matplotlib python-packaging -- \
dash -c '
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/install-siconos/lib &&
export PYTHONPATH=$PYTHONPATH:/tmp/install-siconos/lib/python3.8/site-packages
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
python3 /tmp/install-siconos/bin/siconos \
$tutorials/examples/mechanics/BouncingBall/BouncingBallTS.py'
addr=https://raw.githubusercontent.com/siconos/guix-siconos &&
wget -N $addr/channels/siconos-2021-06-08.scm && \
guix time-machine -C siconos-2021-06-08.scm -- \
environment --pure --ad-hoc [email protected] \
dash python python-numpy python-scipy python-h5py python-packaging -- \
dash -c '
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/install-siconos/lib &&
export PYTHONPATH=$PYTHONPATH:/tmp/install-siconos/lib/python3.8/site-packages
tutorials=${GUIX_ENVIRONMENT}/share/siconos/siconos-tutorials
python3 /tmp/install-siconos/bin/siconos \
$tutorials/examples/mechanics/GeometricPrimitives/cube.py'
See Guix channels for more information about how to configure guix channels.
- it must include the repository url:
(cons
(channel
(name 'guix-hpc)
(url "https://gitlab.inria.fr/bremond/guix-hpc.git")
(branch "add-siconos"))
%default-channels)
- some branch specification may be added:
(list
(channel
(name 'guix-hpc)
(url "https://gitlab.inria.fr/bremond/guix-hpc.git")
(branch "add-siconos"))
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "version-1.4.0")))
- for reproducibility commits are necessary:
(list (channel
(name 'guix-hpc)
(url "https://gitlab.inria.fr/bremond/guix-hpc.git")
(branch "add-siconos")
(commit
"e51151ff99fa8f97ffb9133f31745933dbb46ec8"))
(channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "master")
(commit
"461577f0fce1b69a88a752857eeee2e9e1116d6c")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))))
Some specifications are available in the channel branch of this repository. They are named with this convention:
- without constraints, the channels file is named
siconos-now.scm
- with constraints on commits with the same date for Siconos channel
and Guix channel:
siconos-<iso 8601 date of commits>.scm
- with different dates for Siconos channel and Guix channel:
siconos-<iso 8601 date of siconos commits>-<iso 8601 date of Guix commits>.scm
addr=https://raw.githubusercontent.com/siconos/guix-siconos
wget -q -N $addr/channels/siconos-now.scm
addr=https://raw.githubusercontent.com/siconos/guix-siconos
wget -q -N $addr/channels/siconos-2021-05-05.scm
addr=https://raw.githubusercontent.com/siconos/guix-siconos
wget -q -N $addr/channels/siconos-now.scm && \
guix time-machine -C siconos-now.scm -- \
describe -f channels 2>/dev/null > \
siconos-$(date --iso-8601).scm