scalene
Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python with AI-powered optimization proposals
File Explorer
Download Latest Version (.zip)- bug_report.md
- feature_request.md
- blacken.yml
- build-and-upload.yml
- codeql.yml
- run-linters.yml
- test-smoketests.yml
- tests.yml
- FUNDING.yml
- c_cpp_properties.json
- windows-memory-profiling-port.md
- bench_torch_memory.py
- benchmark.py
- julia1_nopil.py
- measure_profiler_memory.py
- new_benchmark.py
- pystone.py
- profiler-comparison-old.png
- profiler-comparison.png
- sample-profile-pystone.png
- scalene-async-pies.png
- scalene-call-stacks.png
- scalene-memory-stacks.png
- scalene-timeline.png
- scalene-video-img.png
- slack-logo.png
- cpu-accuracy-comparison.png
- osdi23-berger.pdf
- Ozsvald-tweet.png
- scalene-demo.ipynb
- scalene-gui-example-full.png
- scalene-gui-example.png
- scalene-icon-white.png
- scalene-image-large.png
- scalene-image-old.png
- scalene-image.png
- scalene-paper.pdf
- semantic-scholar-success.png
- scalene_verified_core.py
- ScaleneExtract.lean
- Attribution.lean
- ClassifierAccuracy.lean
- CopyVolumeWiring.lean
- ExponentialSampler.lean
- ExtractMirror.lean
- LeakTrackerAudit.lean
- LeakTrackerConcurrency.lean
- MallocFootprintWiring.lean
- MemorySampler.lean
- MetricCorrectness.lean
- PerLineAttribution.lean
- PerLineMallocAttribution.lean
- PoissonArrivals.lean
- ProfilerCorrectness.lean
- PythonNativeClassifier.lean
- SignalSafety.lean
- SpaceSaving.lean
- .gitignore
- lake-manifest.json
- lakefile.toml
- lean-toolchain
- Scalene.lean
- Deadlock.cfg
- Deadlock.tla
- SignalSafety.tla
- SignalSafety_Bug.cfg
- SignalSafety_Fix.cfg
- HANDOFF.md
- README.md
- STATUS.md
- amazon.ts
- anthropic.ts
- azure.ts
- bootstrap.bundle.min.js
- bootstrap.min.css
- example-profile.js
- favicon.ico
- gemini.ts
- gui-elements.ts
- index.html
- index.html.template
- jquery-3.6.0.slim.min.js
- list-amazon-models.py
- ollama.ts
- openai.ts
- optimizations.ts
- package-lock.json
- package.json
- persistence.ts
- prism.css
- prism.d.ts
- prism.js
- profile.json
- profiler.html
- README.md
- scalene-demo.ts
- scalene-fetch.ts
- scalene-gui-bundle.js
- scalene-gui.ts
- scalene-image.png
- tablesort.d.ts
- tablesort.js
- TODO-TypeScript.md
- tsconfig.json
- utils.ts
- __init__.py
- __main__.py
- adaptive.py
- find_browser.py
- get_module_details.py
- hyperloglog.py
- launchbrowser.py
- merge_scalene_neuron_profiles.py
- profile.py
- README.md
- redirect_python.py
- replacement_asyncio.py
- replacement_exec.py
- replacement_exit.py
- replacement_fork.py
- replacement_get_context.py
- replacement_lock.py
- replacement_mp_lock.py
- replacement_pjoin.py
- replacement_poll_selector.py
- replacement_sem_lock.py
- replacement_signal_fns.py
- replacement_thread_join.py
- replacement_thread_start.py
- runningstats.py
- scalene-usage.txt
- scalene_accelerator.py
- scalene_analysis.py
- scalene_apple_gpu.py
- scalene_arguments.py
- scalene_async.py
- scalene_client_timer.py
- scalene_config.py
- scalene_cpu_profiler.py
- scalene_funcutils.py
- scalene_jax.py
- scalene_json.py
- scalene_jupyter.py
- scalene_leak_analysis.py
- scalene_library_profiler.py
- scalene_library_registry.py
- scalene_lifecycle.py
- scalene_mac_sampler.py
- scalene_magics.py
- scalene_mapfile.py
- scalene_memory_profiler.py
- scalene_neuron.py
- scalene_nvidia_gpu.py
- scalene_output.py
- scalene_parseargs.py
- scalene_preload.py
- scalene_profiler.py
- scalene_signal_manager.py
- scalene_signals.py
- scalene_sigqueue.py
- scalene_statistics.py
- scalene_tensorflow.py
- scalene_torch.py
- scalene_tracer.py
- scalene_tracing.py
- scalene_utility.py
- scalene_windows.py
- set_nvidia_gpu_modes.py
- sorted_reservoir.py
- sparkline.py
- syntaxline.py
- time_info.py
- common.hpp
- common_win.hpp
- eintr_retry.hpp
- lowdiscrepancy.hpp
- mallocrecursionguard.hpp
- mallocrecursionguard_win.hpp
- memcpysampler.hpp
- poissonsampler.hpp
- pyptr.h
- pywhere.hpp
- samplefile.hpp
- samplefile_win.hpp
- sampleheap.hpp
- sampleheap_win.hpp
- sampler.hpp
- scaleneheader.hpp
- sharded_size_map.hpp
- thresholdsampler.hpp
- traceconfig.hpp
- get_line_atomic.cpp
- libscalene.cpp
- libscalene_windows.cpp
- native_unwind.cpp
- pywhere.cpp
- traceconfig.cpp
- dataframe-select-optimized.py
- dataframe-select-original.py
- README.md
- svm_data.pkl
- README.md
- svm-optimized.py
- svm-original.py
- README.md
- publisher.txt
- runtime-settings.txt
- transforms.txt
- alternatives.txt
- problems.txt
- distributing.txt
- enthought-plan.txt
- enthought-rfp.txt
- hacking.txt
- policies.txt
- pysource.txt
- release.txt
- repository.txt
- runtime-settings-processing.txt
- semantics.txt
- testing.txt
- todo.txt
- website.txt
- cmdline-tool.txt
- html-stylesheets.txt
- i18n.txt
- rst-directives.txt
- rst-roles.txt
- security.txt
- pep-0256.txt
- pep-0257.txt
- pep-0258.txt
- pep-0287.txt
- definitions.txt
- directives.txt
- introduction.txt
- mathematics.txt
- restructuredtext.txt
- roles.txt
- doctree.txt
- big-black.png
- big-white.png
- default.png
- happy_monkey.png
- medium-black.png
- medium-white.png
- rsp-all.png
- rsp-breaks.png
- rsp-covers.png
- rsp-cuts.png
- rsp-empty.png
- rsp-objects.png
- rsp.svg
- s5-files.png
- s5-files.svg
- small-black.png
- small-white.png
- biohazard-bitmap-scaling.svg
- biohazard-bitmap.svg
- biohazard-scaling.svg
- biohazard.png
- biohazard.svg
- biohazard.swf
- pens.mp4
- title-scaling.svg
- title.png
- title.svg
- cheatsheet.txt
- demo.txt
- quickstart.txt
- config.txt
- emacs.txt
- html.txt
- latex.txt
- links.txt
- mailing-lists.txt
- manpage.txt
- odt.txt
- smartquotes.txt
- tools.txt
- index.txt
- bm_async_tree_io.py
- bm_docutils.py
- bm_fannukh.py
- bm_mdp.py
- bm_pprint.py
- bm_raytrace.py
- bm_sympy.py
- README.md
- test-issue124.py
- test-issue126.py
- test-issue130.py
- test-issue156.py
- test-issue167.py
- test-issue193.py
- test-issue244.py
- test-issue256.py
- test-issue266.py
- test-issue31.py
- test-issue379.py
- test-issue691.py
- test-issue74.py
- test-issue914.py
- arithmetic_smear.py
- bigmem_driver.py
- line_after_final_alloc.py
- loop_below_threshold.py
- loop_with_multiple_lines.py
- loop_with_one_alloc.py
- loop_with_two_allocs.py
- mt_gil_release_worker.py
- mt_two_workers.py
- nested_allocator.py
- st_python_vs_c.py
- st_two_allocators.py
- bm_pyflate.py
- bm_raytrace.py
- bm_richards.py
- bm_scimark.py
- bm_spectral_norm.py
- bm_mdp.py
- bm_pyflate.py
- bm_raytrace.py
- bm_richards.py
- bm_scimark.py
- bm_spectral_norm.py
- bm_sympy.py
- issue_659_workload.py
- multiprocessing_test.py
- native_thread_alloc.c
- new_mp_test.py
- pool-test.py
- pool_spawn_test.py
- profile_annotation_test.py
- signal_test.py
- small_mp_test.py
- smoketest.py
- smoketest_issue_1022.py
- smoketest_issue_659.py
- smoketest_line_invalidation.py
- smoketest_pool_spawn.py
- smoketest_profile_decorator.py
- test-martinheinz.py
- test-memory.py
- test-native-thread-alloc-ctypes.py
- test-native-thread-alloc.py
- test-pprofile.py
- test-size.py
- test-torch-thread-alloc.py
- test_async_demo.py
- test_freethreaded_parity.py
- test_sparkline.py
- test_timers.py
- test_tracer.py
- testflask-driver.py
- testflask.py
- testme.py
- testpyt.py
- testtf.py
- threads-test.py
- timeline_view_demo.py
- torchtest.py
- _scalene_subprocess.py
- conftest.py
- test_async_profiling.py
- test_child_cmdline.py
- test_classifier_soundness.py
- test_cli_leak_velocity_zero_elapsed.py
- test_combined_stacks_gui.py
- test_coverup_1.py
- test_coverup_106.py
- test_coverup_107.py
- test_coverup_109.py
- test_coverup_11.py
- test_coverup_110.py
- test_coverup_112.py
- test_coverup_113.py
- test_coverup_115.py
- test_coverup_116.py
- test_coverup_117.py
- test_coverup_118.py
- test_coverup_12.py
- test_coverup_121.py
- test_coverup_122.py
- test_coverup_123.py
- test_coverup_125.py
- test_coverup_128.py
- test_coverup_13.py
- test_coverup_131.py
- test_coverup_132.py
- test_coverup_133.py
- test_coverup_136.py
- test_coverup_137.py
- test_coverup_139.py
- test_coverup_14.py
- test_coverup_15.py
- test_coverup_16.py
- test_coverup_17.py
- test_coverup_19.py
- test_coverup_2.py
- test_coverup_20.py
- test_coverup_21.py
- test_coverup_22.py
- test_coverup_23.py
- test_coverup_24.py
- test_coverup_25.py
- test_coverup_26.py
- test_coverup_28.py
- test_coverup_29.py
- test_coverup_3.py
- test_coverup_30.py
- test_coverup_31.py
- test_coverup_32.py
- test_coverup_33.py
- test_coverup_34.py
- test_coverup_36.py
- test_coverup_37.py
- test_coverup_38.py
- test_coverup_39.py
- test_coverup_4.py
- test_coverup_40.py
- test_coverup_41.py
- test_coverup_44.py
- test_coverup_45.py
- test_coverup_46.py
- test_coverup_47.py
- test_coverup_5.py
- test_coverup_50.py
- test_coverup_52.py
- test_coverup_53.py
- test_coverup_54.py
- test_coverup_55.py
- test_coverup_56.py
- test_coverup_59.py
- test_coverup_60.py
- test_coverup_61.py
- test_coverup_62.py
- test_coverup_63.py
- test_coverup_64.py
- test_coverup_65.py
- test_coverup_66.py
- test_coverup_68.py
- test_coverup_69.py
- test_coverup_7.py
- test_coverup_71.py
- test_coverup_72.py
- test_coverup_73.py
- test_coverup_74.py
- test_coverup_75.py
- test_coverup_77.py
- test_coverup_78.py
- test_coverup_79.py
- test_coverup_8.py
- test_coverup_80.py
- test_coverup_81.py
- test_coverup_82.py
- test_coverup_83.py
- test_coverup_84.py
- test_coverup_85.py
- test_coverup_87.py
- test_coverup_88.py
- test_coverup_89.py
- test_coverup_9.py
- test_coverup_90.py
- test_coverup_91.py
- test_coverup_92.py
- test_coverup_93.py
- test_coverup_94.py
- test_coverup_96.py
- test_coverup_97.py
- test_coverup_98.py
- test_coverup_99.py
- test_cpu_attribution.py
- test_eintr_retry.py
- test_hyperloglog.py
- test_issue1032_core_utilization_clamp.py
- test_issue1063_non_ascii_profile_only.py
- test_issue1086_non_ascii_paths.py
- test_issue999_wallclock.py
- test_jax_profiler.py
- test_jupyter_display_import.py
- test_leak_velocity_zero_elapsed.py
- test_line_attribution_nested.py
- test_mac_sampler.py
- test_memory_arithmetic_smear.py
- test_memory_multithreaded.py
- test_memory_multithreaded_gil_release.py
- test_memory_multithreaded_stacks.py
- test_memory_python_vs_c.py
- test_memory_stack_leaf_singlethread.py
- test_memory_stacks_bigmem.py
- test_memory_two_allocators.py
- test_multiprocessing_pool_spawn.py
- test_multiprocessing_spawn.py
- test_native_stacks.py
- test_nested_package_relative_import.py
- test_on_off_windows.py
- test_perthread_stack_stitching.py
- test_runningstats.py
- test_scalene_json.py
- test_schema_combined_stacks.py
- test_signal_all_threads_cap.py
- test_signal_handler_recursion_guard.py
- test_stacks_zero_cpu_samples.py
- test_sysmon_tool_id_conflict.py
- test_tensorflow_profiler.py
- test_torch_profiler.py
- test_verified_space_saving.py
- .gitignore
- .readthedocs.yaml
- CITATION.cff
- CLAUDE.md
- CMakeLists.txt
- CODE_OF_CONDUCT.md
- demo_torch_jit.py
- GNUmakefile
- index.rst
- LICENSE
- Makefile
- MANIFEST.in
- mypy.ini
- Pipfile
- Pipfile.lock
- pyproject.toml
- pyrightconfig.json
- pytest.ini
- README.md
- refactoring_todo.md
- requirements.txt
- ruff.toml
- Scalene-Agents.md
- Scalene-Debugging.md
- Scalene-GUI.md
- scalene-image-white.png
- setup.py
# Installation Guide
git clone https://github.com/plasma-umass/scalene
Downloads the entire project code from GitHub to your computer.
cd scalene
Moves into the project folder you just downloaded.
2. CMake
Medium Recommendedmkdir build && cd build
Creates a folder to hold the build output and moves into it.
cmake ..
Analyzes the source code and generates build configuration files (must be run inside the build folder).
make
Compiles the code based on the generated build configuration to produce an executable.
3. Node.js
Easycd scalene/scalene-gui
This project's files live in a subfolder, so move into it first.
npm install
Downloads and installs the libraries listed in package.json.
npm start
Starts the development/run server.
4. Python
Easypython3 -m pip install -U scalene
Installs the Python libraries listed in requirements.txt (or similar).
python3 -m scalene run your_prog.py # equivalent alternative
Runs the Python script (or module).
in Jupyter, line mode:
Type this command into your terminal and run it.
in Jupyter, cell mode:
Type this command into your terminal and run it.
% python3 -m scalene.profile --on --pid <PID> # resume profiling
Runs the Python script (or module).
Pulled directly from this repo's README.
5. Make
Medium- Git Needed to download the project code from GitHub.
- Make Usually pre-installed on Linux/macOS. On Windows, install separately (e.g. via MSYS2 or WSL).
make
Compiles the code based on the generated build configuration to produce an executable.
