Numba (Python)
Numba
| Développé par | Travis Oliphant (en) |
|---|---|
| Dernière version | 0.67.0 ()[1] |
| Dépôt | github.com/numba/numba |
| Assurance qualité | Intégration continue |
| Écrit en | C et Python |
| Type |
Compilateur Logiciel numérique (d) |
| Licence | BSD 2-clauses (en) |
| Site web | numba.pydata.org |
Numba est un compilateur à la volée open-source qui traduit un sous-ensemble de Python et de NumPy en code machine, en utilisant LLVM[2].
Numba est développé à partir de 2012 par Travis Oliphant (en) (également cofondateur de la distribution Anaconda et cocréateur des bibliothèques NumPy et SciPy).
Exemple
Numba s'utilise en appliquant le décorateur numba.jit à une fonction Python.
import numba
import random
@numba.jit
def monte_carlo_pi(n_samples: int) -> float:
"""Monte Carlo"""
acc = 0
for i in range(n_samples):
x = random.random()
y = random.random()
if (x**2 + y**2) < 1.0:
acc += 1
return 4.0 * acc / n_samples
Notes et références
- ↑ « Release 0.67.0 », (consulté le )
- ↑ Siu Kwan Lam, Antoine Pitrou et Stanley Seibert, « Numba: a LLVM-based Python JIT compiler », Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC, Association for Computing Machinery, , p. 1–6 (ISBN 978-1-4503-4005-2, DOI 10.1145/2833157.2833162, lire en ligne, consulté le )
Liens externes
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.