|
| 1 | +# Using Fluidsim on Gricad clusters |
| 2 | + |
| 3 | +We show in this directory |
| 4 | +(<https://foss.heptapod.net/fluiddyn/fluidsim/-/tree/branch/default/doc/examples/clusters/gricad_guix>) |
| 5 | +how to use Fluidsim on Gricad clusters. The main documentation for this HPC platform is |
| 6 | +[here](https://gricad-doc.univ-grenoble-alpes.fr/hpc/). We will use |
| 7 | +[Guix](https://gricad-doc.univ-grenoble-alpes.fr/hpc/softenv/guix/), which is one of the |
| 8 | +recommended package managers for this platform. |
| 9 | + |
| 10 | +## Get a login and setup ssh |
| 11 | + |
| 12 | +Get an account on <https://perseus.univ-grenoble-alpes.fr/>. |
| 13 | + |
| 14 | +Set an ssh key and the alias |
| 15 | + |
| 16 | +```sh |
| 17 | +alias sshdahu='ssh -X dahu.ciment' |
| 18 | +``` |
| 19 | + |
| 20 | +## Setup Mercurial with UV |
| 21 | + |
| 22 | +Install UV with |
| 23 | + |
| 24 | +```sh |
| 25 | +wget -qO- https://astral.sh/uv/install.sh | sh |
| 26 | +``` |
| 27 | + |
| 28 | +Logout and login to get a new shell. UV should be available. |
| 29 | + |
| 30 | +```sh |
| 31 | +uv --version |
| 32 | +``` |
| 33 | + |
| 34 | +Install and setup Mercurial: |
| 35 | + |
| 36 | +```sh |
| 37 | +uv tool install mercurial --with hg-evolve --with hg-git |
| 38 | +uvx hg-setup init -f |
| 39 | +``` |
| 40 | + |
| 41 | +## Setup Guix |
| 42 | + |
| 43 | +The first thing to do, is to create the file `~/.config/guix/channels.scm` with the |
| 44 | +following content: |
| 45 | + |
| 46 | +```lisp |
| 47 | +(cons* (channel |
| 48 | + (name 'gricad-guix-packages) |
| 49 | + (url "https://gricad-gitlab.univ-grenoble-alpes.fr/bouttiep/gricad_guix_packages.git") |
| 50 | + (branch "master")) |
| 51 | + %default-channels) |
| 52 | +``` |
| 53 | + |
| 54 | +Once this is done, you can load and update the Guix environment: |
| 55 | + |
| 56 | +```sh |
| 57 | +source /applis/site/guix-start.sh |
| 58 | +guix pull # This can take a very long time |
| 59 | +``` |
| 60 | + |
| 61 | +You only need to update the Guix environment (and thus run `guix pull`) when a package |
| 62 | +you want to use has been created or updated. |
| 63 | + |
| 64 | +After `guix pull`, you have to run the following command to be sure you use the latest |
| 65 | +`guix` command: |
| 66 | + |
| 67 | +```sh |
| 68 | +GUIX_PROFILE="$HOME/.config/guix/current" |
| 69 | +. "$GUIX_PROFILE/etc/profile" |
| 70 | +``` |
| 71 | + |
| 72 | +## Install Fluidsim from source |
| 73 | + |
| 74 | +Clone the Fluidsim repository in `$HOME/dev`: |
| 75 | + |
| 76 | +```sh |
| 77 | +hg clone https://foss.heptapod.net/fluiddyn/fluidsim ~/dev/fluidsim |
| 78 | +``` |
| 79 | + |
| 80 | +Update to |
| 81 | + |
| 82 | +```sh |
| 83 | +cd ~/dev/fluidsim |
| 84 | +hg up doc-gricad-guix |
| 85 | +``` |
| 86 | + |
| 87 | +### Change the changeset used for the Guix environment |
| 88 | + |
| 89 | +One needs to choose a changeset (a commit) and get its changeset reference (its hash). |
| 90 | +One can study them with: |
| 91 | + |
| 92 | +```sh |
| 93 | +cd ~/dev/fluidsim |
| 94 | +# get the node (changeset reference, hash) of the current commit |
| 95 | +# (you can choose this commit) |
| 96 | +hg log -r . -T "{node}" |
| 97 | +# study all commits |
| 98 | +# (you can choose another commit) |
| 99 | +hg log -G |
| 100 | +``` |
| 101 | + |
| 102 | +Get the Guix hash with (note: `guix download` does not support Mercurial). In a new |
| 103 | +terminal (replace `<changeset_ref>` with the chosen Mercurial node): |
| 104 | + |
| 105 | +```sh |
| 106 | +source /applis/site/guix-start.sh |
| 107 | +hg clone https://foss.heptapod.net/fluiddyn/fluidsim ~/dev/fluidsim-clean |
| 108 | +cd ~/dev/fluidsim-clean |
| 109 | +hg up <changeset_ref> --clean |
| 110 | +hg purge --all |
| 111 | +guix hash -x -r . |
| 112 | +``` |
| 113 | + |
| 114 | +Change the Mercurial reference and the hash in |
| 115 | +`~/dev/fluidsim/doc/examples/clusters/gricad_guix/python-fluidsim.scm`. |
| 116 | + |
| 117 | +### Build-install from source |
| 118 | + |
| 119 | +```sh |
| 120 | +source /applis/site/guix-start.sh |
| 121 | +DIR_MANIFEST=$HOME/dev/fluidsim/doc/examples/clusters/gricad_guix |
| 122 | +# This will take a while |
| 123 | +guix shell --pure -m $DIR_MANIFEST/manifest.scm -f $DIR_MANIFEST/python-fluidsim.scm |
| 124 | +``` |
| 125 | + |
| 126 | +## Test Fluidsim in sequential |
| 127 | + |
| 128 | +```sh |
| 129 | +source /applis/site/guix-start.sh |
| 130 | +DIR_MANIFEST=$HOME/dev/fluidsim/doc/examples/clusters/gricad_guix |
| 131 | +guix shell --pure -m $DIR_MANIFEST/manifest.scm -f $DIR_MANIFEST/python-fluidsim.scm |
| 132 | +python3 -m pytest --pyargs fluidsim |
| 133 | +``` |
| 134 | + |
| 135 | +## Submit a Fluidfft benchmark |
| 136 | + |
| 137 | +```sh |
| 138 | +cd ~/dev/fluidsim/doc/examples/clusters/gricad_guix |
| 139 | +oarsub -S ./job_fluidfft_bench.oar |
| 140 | +``` |
| 141 | + |
| 142 | +## Submit a Fluidsim benchmark |
| 143 | + |
| 144 | +Here, we are going to show how to do it with two strategies, either manually write a OAR |
| 145 | +script or use fluiddyn to write it. |
| 146 | + |
| 147 | +### Hand written OAR script |
| 148 | + |
| 149 | +```sh |
| 150 | +cd ~/dev/fluidsim/doc/examples/clusters/gricad_guix |
| 151 | +oarsub -S ./job_fluidsim_bench.oar |
| 152 | +``` |
| 153 | + |
| 154 | +### With fluiddyn |
| 155 | + |
| 156 | +Prepare a virtual env (1 time). From a new terminal: |
| 157 | + |
| 158 | +```sh |
| 159 | +python3 -m venv ~/venv_fluiddyn |
| 160 | +. ~/venv_fluiddyn/bin/activate |
| 161 | +pip install fluiddyn |
| 162 | +``` |
| 163 | + |
| 164 | +Submit with |
| 165 | + |
| 166 | +```sh |
| 167 | +. ~/venv_fluiddyn/bin/activate |
| 168 | +cd ~/dev/fluidsim/doc/examples/clusters/gricad_guix |
| 169 | +python submit_bench_fluidsim.py |
| 170 | +``` |
| 171 | + |
| 172 | +````{note} |
| 173 | +Note that the script `submit_bench_fluidsim.py` contains the line: |
| 174 | +
|
| 175 | +```python |
| 176 | +from fluiddyn.clusters.gricad import DahuGuix16_6130 as Cluster |
| 177 | +``` |
| 178 | +
|
| 179 | +The classes `DahuGuix...` are able to write OAR scripts for using Dahu with Guix. |
| 180 | +
|
| 181 | +```` |
0 commit comments