Outils pour utilisateurs

Outils du site


cluster-lbt:extra-tools:conda
no way to compare when less than two revisions

Différences

Ci-dessous, les différences entre deux révisions de la page.


cluster-lbt:extra-tools:conda [2020/06/18 13:37] (Version actuelle) – créée - modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +====== Conda on Baal ======
 +
 +
 +Conda, more specifically Miniconda, has been installed on Baal cluster. Conda is an open source package management system and environment management which allows you to install packages in separate environments. It is mainly for Python but can be used also for R. Here the website: [[https://docs.conda.io/projects/conda/en/latest/|https://docs.conda.io/projects/conda/en/latest/]] 
 +
 +On Baal, there is two conda modules :
 +  - **miniconda-py2/latest** for Python 2
 +  - **miniconda-py3/latest** for Python 3
 +Unless absolute requirement, you should always use the version for Python 3.
 +
 +<note important>On the cluster, all commands to prepare an environment (create, install packages, etc) have to be done on the master (or login) node. Conda dont do compilation but just downloading and extracting archives</note>
 +
 +==== Create Environments ====
 +
 +Conda works with environments which are isolated from the rest of the OS. You can have as much as environments you like.
 +To create one :
 +<code>
 +[baal master node] $ conda create -n "test" python=3.7
 +</code>
 +will create an environment called //test// with python 3.7
 +<note important>By default, conda create environments in your workdir (/workdir/my_team/username/.conda/envs) so they can be used easily on the compute nodes.</note>
 +
 +==== Using Environments ====
 +
 +Now we created an environment called //test//, let's use it :
 +<code>
 +[baal master node] $ conda activate test
 +(test) [baal master node] $ 
 +</code>
 +When activated, you should see the name of the environment between parenthesis, like above.
 +
 +To stop using the environment, juste deactivate it:
 +<code>
 +(test) [baal master node] $ conda deactivate
 +</code>
 +
 +==== Install packages ====
 +
 +Once your environment is activate, you can install packages inside.
 +<code>
 +(test) [baal master node] $ conda install numpy
 +</code>
 +
 +==== Using environment on the compute nodes ===
 +
 +Once you have created your environment and installed packages inside it, you can use it on the computer nodes within your job script.
 +Just add the line to activate it inside your script :
 +
 +<code run.sh>
 +#!/bin/bash
 +#PBS -S /bin/bash
 +#PBS -N <job-name>
 +#PBS -o <job-name>.out
 +#PBS -e <job-name>.err
 +
 +[...]
 +#Modules
 +module load miniconda-py3/latest
 +
 +conda activate test
 +
 +python myscript.py
 +
 +[...]
 +</code>
  
cluster-lbt/extra-tools/conda.txt · Dernière modification : 2020/06/18 13:37 de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki