PyKeOps/fr: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(Created page with "= Versions disponibles = Les versions disponibles sur nos grappes sopnt des wheels Python. Voyez la liste en lançant <code>avail_wheels</code>. {{Command |avail_wheels pykeops |result= name version python arch ------- --------- -------- ------- pykeops 2.2.3 py3 generic }}")
(Updating to match new version of source page)
Line 2: Line 2:
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
__FORCETOC__
__FORCETOC__
The [https://www.kernel-operations.io/keops/index.html KeOps] library lets you compute reductions of large arrays whose entries are given by a mathematical formula or a neural network. It combines efficient C++ routines with an automatic differentiation engine and can be used with Python (NumPy, PyTorch), Matlab and R..
The [https://www.kernel-operations.io/keops/index.html KeOps] library lets you compute reductions of large arrays whose entries are given by a mathematical formula or a neural network. It combines efficient C++ routines with an automatic differentiation engine and can be used with [[Python]] (NumPy, [[PyTorch]]), [[MATLAB]] and [[R]].
</div>
</div>


<div class="mw-translate-fuzzy">
= Versions disponibles =  
= Versions disponibles =  
Les versions disponibles sur nos grappes sopnt des wheels Python. Voyez la liste en lançant <code>avail_wheels</code>.
Les versions disponibles sur nos grappes sopnt des wheels Python. Voyez la liste en lançant <code>avail_wheels</code>.
Line 14: Line 15:
pykeops  2.2.3      py3      generic
pykeops  2.2.3      py3      generic
}}
}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
= Installing PyKeOps in a Python virtual environment =
= Installing PyKeOps in a [[Python#Creating_and_using_a_virtual_environment | Python virtual environment]] =
1. Load runtime dependencies.
1. Load runtime dependencies.
{{Command|module load StdEnv/2023 python/3.11}}
{{Command|module load StdEnv/2023 python/3.11}}
Line 59: Line 61:
}}
}}


<div class="mw-translate-fuzzy">
= Exécution =  
= Exécution =  
Vous pouvez exécuter PyKeOps sur un CPU ou un GPU.  
Vous pouvez exécuter PyKeOps sur un CPU ou un GPU.
</div>


1. Préparez votre script d'exécution.
1. Préparez votre script d'exécution.
Line 120: Line 124:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
2. Submit your job to the scheduler.
2. Before submitting your job, it is important to test that your submission script will start without errors.
Before submitting your job, it is important to test that your submission script will start without errors.
You can do a quick test in an [[Running_jobs#Interactive_jobs|interactive job]].
You can do a quick test in an [[Running_jobs#Interactive_jobs|interactive job]].
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
3. Submit your job to the scheduler.
{{Command
{{Command
|sbatch submit-keops.sh
|sbatch submit-keops.sh
}}
}}
</div>
</div>

Revision as of 18:37, 30 September 2024

Other languages:

The KeOps library lets you compute reductions of large arrays whose entries are given by a mathematical formula or a neural network. It combines efficient C++ routines with an automatic differentiation engine and can be used with Python (NumPy, PyTorch), MATLAB and R.

Versions disponibles

Les versions disponibles sur nos grappes sopnt des wheels Python. Voyez la liste en lançant avail_wheels.

Question.png
[name@server ~]$ avail_wheels pykeops
name     version    python    arch
-------  ---------  --------  -------
pykeops  2.2.3      py3       generic

Installing PyKeOps in a Python virtual environment

1. Load runtime dependencies.

Question.png
[name@server ~]$ module load StdEnv/2023 python/3.11


2. Créez et activez un environnement virtuel Python.

[name@server ~]$ virtualenv --no-download ~/pykeops_env
[name@server ~]$ source ~/pykeops_env/bin/activate


3. Installez une version de PyKeOps avec ses dépendances Python.

(pykeops_env) [name@server ~] pip install --no-index --upgrade pip
(pykeops_env) [name@server ~] pip install --no-index pykeops==X.Y.Z

where X.Y.Z is the exact desired version, for instance 2.2.3. You can omit to specify the version in order to install the latest one available from the wheelhouse.


4. Validez.

(pykeops_env) [name@server ~] python -c 'import pykeops; pykeops.test_numpy_bindings()'


5. Gelez l'environnement et l'ensemble des exigences.

Question.png
(pykeops_env) [name@server ~] pip freeze --local > ~/pykeops-2.2.3-requirements.txt


6. Supprimez l'environnemnent virtuel local.

Question.png
(pykeops_env) [name@server ~] deactivate && rm -r ~/pykeops_env

Exécution

Vous pouvez exécuter PyKeOps sur un CPU ou un GPU.

1. Préparez votre script d'exécution.

File : submit-pykeops-cpu.sh

#!/bin/bash

#SBATCH --account=def-someprof    # adjust this to match the accounting group you are using to submit jobs
#SBATCH --time=08:00:00           # adjust this to match the walltime of your job
#SBATCH --cpus-per-task=4         # adjust this to match the number of cores to use
#SBATCH --mem-per-cpu=4G          # adjust this according to the memory you need per cpu

# Load modules dependencies.
module load StdEnv/2023 python/3.11

# create the virtual environment on the compute node: 
virtualenv --no-download $SLURM_TMPDIR/env
source $SLURM_TMPDIR/env/bin/activate

pip install --no-index --upgrade pip
pip install --no-index -r pykeops-2.2.3-requirements.txt

# test that everything is OK
python -c 'import pykeops; pykeops.test_numpy_bindings()'


File : submit-pykeops-gpu.sh

#!/bin/bash

#SBATCH --account=def-someprof    # adjust this to match the accounting group you are using to submit jobs
#SBATCH --time=08:00:00           # adjust this to match the walltime of your job
#SBATCH --cpus-per-task=4         # adjust this to match the number of cores to use
#SBATCH --mem-per-cpu=4G          # adjust this according to the memory you need per cpu
#SBATCH --gpus=1

# Load modules dependencies. The custom-ctypes is critical here.
module load StdEnv/2023 python/3.11 cuda/12 custom-ctypes

# create the virtual environment on the compute node: 
virtualenv --no-download $SLURM_TMPDIR/env
source $SLURM_TMPDIR/env/bin/activate

pip install --no-index --upgrade pip
pip install --no-index -r pykeops-2.2.3-requirements.txt

# test that nvrtc binding are also found
python -c 'import pykeops; pykeops.test_numpy_bindings()'


2. Before submitting your job, it is important to test that your submission script will start without errors. You can do a quick test in an interactive job.

3. Submit your job to the scheduler.

Question.png
[name@server ~]$ sbatch submit-keops.sh