{"id":16936502,"url":"https://github.com/jonhoo/curb","last_synced_at":"2025-03-22T12:31:59.861Z","repository":{"id":57614697,"uuid":"175891344","full_name":"jonhoo/curb","owner":"jonhoo","description":"Run a process on a particular subset of the available hardware.","archived":false,"fork":false,"pushed_at":"2020-01-27T21:05:02.000Z","size":19,"stargazers_count":36,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T14:55:57.991Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonhoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-15T21:08:17.000Z","updated_at":"2025-02-07T10:46:01.000Z","dependencies_parsed_at":"2022-08-27T03:24:41.461Z","dependency_job_id":null,"html_url":"https://github.com/jonhoo/curb","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fcurb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fcurb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fcurb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fcurb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonhoo","download_url":"https://codeload.github.com/jonhoo/curb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244959444,"owners_count":20538625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T20:57:10.232Z","updated_at":"2025-03-22T12:31:59.531Z","avatar_url":"https://github.com/jonhoo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Crates.io](https://img.shields.io/crates/v/curb.svg)](https://crates.io/crates/curb)\n[![Build Status](https://travis-ci.com/jonhoo/curb.svg?branch=master)](https://travis-ci.com/jonhoo/curb)\n\nA command-line tool to restrict a process from using particular hardware\nresources. It is particularly geared towards performance-sensitive\nmulti-core experiments, in which you may want to avoid or measure the\nimpact of CPU features like [SMT] (e.g., [Intel Hyper-Threading] or\n[NUMA memory]. While this is possible with existing tools like\n[`hwloc-bind`] and [`numactl`], it's often pretty inconvenient to get\nthe result you want. With `curb` on the other hand:\n\n```console\n$ curb --no-smt --no-numa mycommand\n```\n\nYou can also limit the number of cores using something like:\n\n```console\n$ curb --no-smt -n 3 mycommand\n```\n\nBy default, curb picks cores, nodes, and anything else in a\ndeterministic fashion (usually tending towards 0). If you want to pick\nrandomly instead, use `--randomize` (or `-r`).\n\n\n### Passing arguments\n\nWill run `mycommand` _only_ on each physical core on a single NUMA node\n(the first one specifically). Note that if you want to pass additional\narguments to the command under test, you can do so using `--`:\n\n```console\n$ curb --no-smt mycommand -- --no-crash --performance better\n```\n\n### Visualizing the core allocation\n\nTo visualize what CPUs are being used using [`lstopo`], do:\n\n```console\n$ curb --no-smt --no-numa lstopo -- --pid 0\n```\n\nThat should show all active cores in green. If you don't have a window\nmanager running, add `-v` at the end and look for PUs marked with\n`(running)`.\n\n## Dependencies\n\nCurb depends on the [`hwloc` crate], which in turn depends on the\n[`hwloc` C library].\n\n## OS Support\n\nCurb currently only works on `cfg(unix)` systems, because it sets the\nCPU binding [for the current process], and then calls [`exec`]. This\nshould be possible to work around by instead spawning the process,\ngetting its identifier, calling [`set_cpubind_for_process`], and then\nwaiting for the process to exit. However, this has a number of\ndownsides, like the process _initially_ being unconstrained and having\nto proxy things like stdin, stdout, signals, and exit codes. Suggestions\nfor how to support non-UNIX platforms are warmly welcome!\n\n\n  [SMT]: https://en.wikipedia.org/wiki/Simultaneous_multithreading\n  [Intel Hyper-Threading]: https://en.wikipedia.org/wiki/Hyper-threading\n  [NUMA memory]: https://en.wikipedia.org/wiki/Non-uniform_memory_access\n  [`hwloc-bind`]: https://linux.die.net/man/1/hwloc-bind\n  [`numactl`]: https://github.com/numactl/numactl\n  [`lstopo`]: https://linux.die.net/man/1/lstopo\n  [`hwloc` crate]: https://github.com/daschl/hwloc-rs\n  [`hwloc` C library]: https://github.com/daschl/hwloc-rs#prerequisites\n  [for the current process]: https://docs.rs/hwloc/0.5.0/hwloc/struct.Topology.html#method.set_cpubind\n  [`exec`]: https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.exec\n  [`set_cpubind_for_process`]: https://docs.rs/hwloc/0.5.0/hwloc/struct.Topology.html#method.set_cpubind_for_process\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonhoo%2Fcurb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonhoo%2Fcurb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonhoo%2Fcurb/lists"}