{"id":14992143,"url":"https://github.com/PABannier/rust-ggml","last_synced_at":"2025-09-25T14:30:55.238Z","repository":{"id":257793080,"uuid":"630485985","full_name":"PABannier/rust-ggml","owner":"PABannier","description":"Rust bindings for C tensor library ggml","archived":false,"fork":false,"pushed_at":"2023-04-20T13:39:22.000Z","size":69,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T14:53:04.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PABannier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-20T13:37:59.000Z","updated_at":"2023-04-26T12:49:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb617838-a2dc-4f70-9177-facee849c4b4","html_url":"https://github.com/PABannier/rust-ggml","commit_stats":null,"previous_names":["pabannier/rust-ggml"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PABannier%2Frust-ggml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PABannier%2Frust-ggml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PABannier%2Frust-ggml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PABannier%2Frust-ggml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PABannier","download_url":"https://codeload.github.com/PABannier/rust-ggml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234200170,"owners_count":18795139,"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-09-24T15:00:45.994Z","updated_at":"2025-09-25T14:30:50.187Z","avatar_url":"https://github.com/PABannier.png","language":"C","funding_links":[],"categories":["Machine Learning"],"sub_categories":[],"readme":"# ggml-rust\n\nggml-rust is a Rust crate that provides safe and fast bindings to the C tensor computing library called [ggml](https://github.com/ggerganov/ggml). With ggml-rust, you can leverage the power of ggml's tensor operations in your Rust applications, while enjoying Rust safety.\n\n## Features\n\n- Safe: ggml-rust provides a safe Rust API that helps prevent null pointer dereferences and buffer overflows, through Rust's strong type system and memory safety guarantees.\n- Fast: ggml-rust leverages the high-performance tensor operations of ggml, allowing you to efficiently perform computations on multi-dimensional arrays (up to 4 dimensions) of data.\n\n## Installation\n\nggml-Rust requires the ggml C library to be installed on your system. You can install ggml using the following steps:\n\n1. Download the latest version of ggml from the official ggml GitHub repository: [https://github.com/ggml/ggml](https://github.com/ggml/ggml).\n2. Follow the installation instructions provided by ggml to build and install the C library on your system.\n\nOnce you have ggml installed on your system, you can add ggml-Rust as a dependency in your Rust project's `Cargo.toml` file:\n\n```toml\n[dependencies]\nggml-rust = \"0.1.0\"\n```\n\n## Usage\n\nTo use ggml-Rust in your Rust project, simply import it and start using its APIs:\n\n```rust\nuse ggml_rust::\\*;\n\nfn main() {\n    const MEM_SIZE = 16 * 1024 * 1024;  // Allocate enough memory\n    // Setup a context\n    let mut ctx = Context::new(MEM_SIZE, None, false).unwrap();\n\n    // Define the computational graphs\n    let inp_a = ctx.new_tensor_1d(GGML_DTYPE::F32, 1).unwrap();\n    let inp_b = ctx.new_tensor_1d(GGML_DTYPE::F32, 1).unwrap();\n    let mut out = ctx.$operation(\u0026inp_a, \u0026inp_b);\n\n    let mut graph = CGraph::build_forward(\u0026mut out);\n\n    // Input the graph with data\n    inp_a.set_data_f32($input_a);\n    inp_b.set_data_f32($input_b);\n\n    // Forward pass\n    graph.compute(\u0026mut ctx);\n\n    // Get result\n    let res = out.get_data_f32_1d(0).unwrap();\n}\n```\n\nPlease refer to the API documentation for more detailed information on how to use ggml-Rust.\n\n## Organization\n\nThe raw bindings are generated with `rust-bindgen` and stored in `rust_ggml/ffi_ggml` by running\n`cargo build`. The `rust-ggml` crate is built to be a safe wrapper around the unsafe bindings generated\nby `rust-bindgen`.\n\n## Contributing\n\nIf you would like to contribute to ggml-Rust, please see our Contribution Guidelines for more information.\n\n## License\n\nggml-Rust is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPABannier%2Frust-ggml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPABannier%2Frust-ggml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPABannier%2Frust-ggml/lists"}