# Scalene

> CPU, GPU and memory profiler for Python

**Wikidata**: [Q122499502](https://www.wikidata.org/wiki/Q122499502)  
**Source**: https://4ort.xyz/entity/scalene

## Summary
Scalene is a free, open-source profiler for Python that simultaneously measures CPU, GPU, and memory usage down to the line level, distributed under the Apache 2.0 license. Developed by Emery David Berger at the University of Massachusetts Amherst, it is the first profiler to separate time spent in Python from native code and to report per-line memory allocation and copying costs.

## Key Facts
- License: Apache Software License 2.0 (confirmed 14 Sep 2023 via GitHub LICENSE file)
- Developer: Emery David Berger
- Source repository: https://github.com/plasma-umass/scalene (hosted on GitHub, Git revision control)
- Latest cited stable release: 1.3.15, published 4 Oct 2021
- Earliest cited stable release: 1.2.0, published 8 Mar 2021
- Package name on PyPI: scalene
- Described in academic paper: “Scalene: Scripting-Language Aware Profiling for Python”
- Instance of: free software (120 sitelinks on Wikidata)
- Copyright status: copyrighted

## FAQs
### Q: What makes Scalene different from other Python profilers?
A: Scalene is the first profiler to separate Python-level time from native (C/C++) time, report per-line memory allocation and copying, and profile GPU usage—all in a single tool.

### Q: Is Scalene free to use and modify?
A: Yes. Scalene is released under the Apache Software License 2.0, a permissive open-source license that allows free use, study, modification, and redistribution.

### Q: How do I install Scalene?
A: Install the latest stable release directly from PyPI with `pip install scalene`; the package name is “scalene”.

### Q: Who created Scalene?
A: Emery David Berger at the University of Massachusetts Amherst is the primary developer.

## Why It Matters
Python’s ease of use has made it the lingua franca of data science, machine learning, and web development, yet its performance characteristics can be opaque. Traditional profilers either miss memory bottlenecks or overwhelm developers with raw data. Scalene addresses this gap by providing actionable, line-level insights across CPU, GPU, and memory dimensions in a single run. Because it distinguishes time spent in Python bytecode from native extensions, developers can pinpoint whether slowdowns lie in their own code or in underlying C/C++/CUDA libraries. The tool’s low overhead and plain-text/HTML reports make it practical for continuous integration and classroom instruction alike, accelerating optimization cycles and reducing cloud compute bills. In short, Scalene turns Python performance tuning from guesswork into a data-driven, reproducible process.

## Notable For
- First profiler to separate Python vs. native execution time per line
- Only major Python profiler to report both memory allocation and memory copying costs line-by-line
- GPU profiling integrated alongside CPU and memory in one package
- Maintained as free software under Apache 2.0 with public GitHub repository
- Described in peer-reviewed academic research, bridging tooling and programming-language communities

## Body

### Overview
Scalene is a high-performance sampling profiler designed specifically for Python. It outputs detailed reports showing where CPU cycles, GPU kernels, and memory traffic occur, broken down by individual lines of source code. Because it is scripting-language-aware, it attributes time spent in Python bytecode separately from time spent in C/C++ extensions or GPU kernels.

### Licensing and Availability
The project is licensed under the Apache Software License 2.0, verified in the repository’s LICENSE file on 14 September 2023. Source code is hosted at https://github.com/plasma-umass/scalene and is publicly accessible. Scalene is copyrighted, but the Apache license grants broad rights to use, modify, and redistribute the software.

### Release History
All cited stable versions appeared between March and October 2021:
- 1.2.0 – 8 Mar 2021
- 1.3.1 – 2 Apr 2021
- 1.3.2 – 9 Apr 2021
- 1.3.7 – 28 Jun 2021
- 1.3.8 – 29 Jun 2021
- 1.3.9 – 11 Jul 2021
- 1.3.10 – 12 Jul 2021
- 1.3.11 – 15 Jul 2021
- 1.3.12 – 16 Jul 2021
- 1.3.15 – 4 Oct 2021

Each release is tagged in GitHub and published on PyPI, ensuring reproducible installs via `pip install scalene==<version>`.

### Technical Scope
Scalene’s three-in-one approach—CPU, GPU, and memory—eliminates the need to run multiple profilers. Its memory profiler tracks both allocation volume and copying costs, helping developers spot unintended data movement. The GPU component captures kernel launch statistics, complementing CPU-side analysis for machine-learning workloads.

## References

1. [scalene/LICENSE at master · plasma-umass/scalene. GitHub](https://github.com/plasma-umass/scalene/blob/master/LICENSE)
2. [Release 1.2.0. 2021](https://github.com/plasma-umass/scalene/releases/tag/1.2.0)
3. [Release 1.3.1. 2021](https://github.com/plasma-umass/scalene/releases/tag/1.3.1)
4. [Release 1.3.2. 2021](https://github.com/plasma-umass/scalene/releases/tag/1.3.2)
5. [Release 1.3.7. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.7)
6. [Release 1.3.8. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.8)
7. [Release 1.3.9. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.9)
8. [Release 1.3.10. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.10)
9. [Release 1.3.11. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.11)
10. [Release 1.3.12. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.12)
11. [Release 1.3.15. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.15)
12. [Release 1.3.16. 2021](https://github.com/plasma-umass/scalene/releases/tag/v1.3.16)
13. [Release 1.4.0. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.4.0)
14. [Release 1.4.1. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.4.1)
15. [Release 1.4.2. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.4.2)
16. [Release 1.5.0. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.0)
17. [Release 1.5.1. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.1)
18. [Release 1.5.2. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.2)
19. [Release 1.5.3. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.3)
20. [Release 1.5.4. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.4)
21. [Release 1.5.5. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.5)
22. [Release 1.5.6. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.6)
23. [Release 1.5.7. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.7)
24. [Release 1.5.8. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.8)
25. [Release 1.5.10. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.10)
26. [Release 1.5.11. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.11)
27. [Release 1.5.12. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.12)
28. [Release 1.5.13. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.13)
29. [Release 1.5.14. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.14)
30. [Release 1.5.15. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.15)
31. [Release 1.5.16. 2022](https://github.com/plasma-umass/scalene/releases/tag/v1.5.16)
32. [Release 1.5.17. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.17)
33. [Release 1.5.18. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.18)
34. [Release 1.5.19. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.19)
35. [Release 1.5.20. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.20)
36. [Release 1.5.21.2. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.21.2)
37. [Release 1.5.21.4. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.21.4)
38. [Release 1.5.22.2. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.22.2)
39. [Release 1.5.23. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.23)
40. [Release 1.5.24.1. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.24.1)
41. [Release 1.5.24.2. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.24.2)
42. [Release 1.5.25. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.25)
43. [Release 1.5.26. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.26)
44. [Release 1.5.27. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.27)
45. [Release 1.5.28. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.28)
46. [Release 1.5.29. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.29)
47. [Release 1.5.30. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.30)
48. [Release 1.5.31. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.31)
49. [Release 1.5.31.1. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.31.1)
50. [Release 1.5.32. 2023](https://github.com/plasma-umass/scalene/releases/tag/v1.5.32)