Skip to content
Snippets Groups Projects
Commit 93eb4063 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

pfc-2g

parent a6b60b34
No related branches found
No related tags found
No related merge requests found
# pfcalcul 2
# pfcalcul 2 - GPU
extend pfc-1 with a venv
extend pfc-2 for GPU use
You'll need:
- understanding of pfc-1
- a copy of this example in `/pfcalcul/work/$USER/pfc-2`
- understanding of pfc-2
- a copy of this example in `/pfcalcul/work/$USER/pfc-2g`
- create a venv inside and instadd dependencies, eg.:
```bash
cd /pfcalcul/work/$USER/pfc-2
cd /pfcalcul/work/$USER/pfc-2g
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip
......
pin
--extra-index-url https://download.pytorch.org/whl/cu113
torch
......@@ -5,6 +5,9 @@
#SBATCH --mail-type=ALL
#SBATCH --output=output-%A-%a-%N.log
#SBATCH --error=output-%A-%a-%N.err
#SBATCH --gres=gpu:1
#SBATCH --partition=robgpu
#SBATCH --account=dept_rob
source venv/bin/activate
......
#!/usr/bin/env python3
"""Hard work here. Not efficient, but hard."""
"""Hard work here. Not efficient, but hard. On CUDA device."""
from typing import Tuple
import pinocchio as pin # type: ignore
import torch # type: ignore
def is_prime(number: int) -> bool:
"""Check if a number is prime."""
return not any(number % i == 0 for i in range(2, number))
t = torch.arange(2, number, device="cuda")
return not bool((number % t == 0).any().cpu())
def find_prime(goal: int = 10, verbose: bool = False) -> Tuple[int, int]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment