{"id":13438786,"url":"https://github.com/arrayfire/arrayfire-rust","last_synced_at":"2025-05-15T04:00:18.738Z","repository":{"id":32243124,"uuid":"35817370","full_name":"arrayfire/arrayfire-rust","owner":"arrayfire","description":"Rust wrapper for ArrayFire","archived":false,"fork":false,"pushed_at":"2023-09-24T19:19:45.000Z","size":19244,"stargazers_count":827,"open_issues_count":25,"forks_count":59,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-05-11T03:57:26.003Z","etag":null,"topics":["arrayfire","cuda","gpgpu","gpu","hpc","opencl","rust","rust-bindings"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arrayfire.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}},"created_at":"2015-05-18T12:44:47.000Z","updated_at":"2025-04-25T04:10:02.000Z","dependencies_parsed_at":"2023-12-16T15:12:46.377Z","dependency_job_id":null,"html_url":"https://github.com/arrayfire/arrayfire-rust","commit_stats":{"total_commits":407,"total_committers":36,"mean_commits":"11.305555555555555","dds":0.2506142506142506,"last_synced_commit":"bd3be3ed48887f8d5a86fbcd59fe5ac2edbeef58"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrayfire%2Farrayfire-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrayfire%2Farrayfire-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrayfire%2Farrayfire-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrayfire%2Farrayfire-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arrayfire","download_url":"https://codeload.github.com/arrayfire/arrayfire-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270640,"owners_count":22042858,"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":["arrayfire","cuda","gpgpu","gpu","hpc","opencl","rust","rust-bindings"],"created_at":"2024-07-31T03:01:08.428Z","updated_at":"2025-05-15T04:00:18.664Z","avatar_url":"https://github.com/arrayfire.png","language":"Rust","readme":"[![ci][19]][16] [![docs][18]][3] [![book][22]][21] [![slack][17]][4] [![github-discussions][20]][5]\n\n# ArrayFire Rust Bindings\n\n[ArrayFire][1] is a high performance library for parallel computing with an easy-to-use API. It\nenables users to write scientific computing code that is portable across CUDA, OpenCL and CPU\ndevices. This project provides Rust bindings for the ArrayFire library. Given below table shows\nthe rust bindings compatability with ArrayFire.  If you find any bugs, please report them [here][2].\n\n| arrayfire-rust | ArrayFire |\n|:--------------:|:---------:|\n|         M.m.p1 |    M.m.p2 |\n\nOnly, Major(M) \u0026 Minor(m) version numbers need to match. *p1* and *p2* are patch/fix updates for\n`arrayfire-rust` \u0026 `ArrayFire` respectively, and they don't need to match.\n\n## Supported platforms\n\nLinux, Windows and OSX. Rust 1.31 or newer is required.\n\n## Use from Crates.io [![][6]][7] [![][8]][9]\n\nTo use the rust bindings for ArrayFire from crates.io, the following requirements are to be met first.\n\n1. [Download and install ArrayFire binaries][10] based on your operating system. Depending on the\n   method of your installation for Linux, steps (2) \u0026 (3) may not be required. If that is the case,\n   proceed to step (4) directly.\n2. Set the evironment variable `AF_PATH` to point to ArrayFire installation root folder.\n3. Make sure to add the path to lib files to your path environment variables.\n    - On Linux: do `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AF_PATH/lib64`\n    - On OSX: do `export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$AF_PATH/lib`\n    - On Windows: Add `%AF_PATH%\\lib` to your PATH environment variable.\n4. Add `arrayfire = \"3.8\"` to the dependencies section of your project's Cargo.toml file.\n   Make sure to change the version to latest available.\n\nOnce step (4) is over, you should be able to use ArrayFire in your Rust project. If you find any\nbugs, please report them [here][2].\n\n## Build from Source\n\nEdit [build.conf](build.conf) to modify the build flags. The structure is a simple JSON blob.\nCurrently Rust does not allow key:value pairs to be passed from the CLI. To use an existing\nArrayFire installation modify the first three JSON values. You can install ArrayFire using\none of the following two ways.\n\n- [Download and install binaries][10]\n- [Build and install from source][1]\n\nTo build arrayfire submodule available in the rust wrapper repository, you have to do the following.\n\n```bash\ngit submodule update --init --recursive\ncargo build // use --all to build all crates in the workspace\n```\nThis is recommended way to build Rust wrapper since the submodule points to the most compatible\nversion of ArrayFire the Rust wrapper has been tested with. You can find the ArrayFire dependencies below.\n\n- [Linux][11]\n- [OSX][12]\n- [Windows][13]\n\n## Example\n\n```rust\nlet num_rows: u64 = 5;\nlet num_cols: u64 = 3;\nlet dims = Dim4::new(\u0026[num_rows, num_cols, 1, 1]);\nlet a = randu::\u003cf32\u003e(dims);\naf_print!(\"Create a 5-by-3 matrix of random floats on the GPU\", a);\n```\n\n### Sample output\n\n```bash\n~/p/arrayfire_rust\u003e cargo run --example helloworld\n...\nCreate a 5-by-3 matrix of random floats on the GPU\n[5 3 1 1]\n    0.7402     0.4464     0.7762\n    0.9210     0.6673     0.2948\n    0.0390     0.1099     0.7140\n    0.9690     0.4702     0.3585\n    0.9251     0.5132     0.6814\n...\n```\n\n### Troubleshooting\n\nIf the build command fails with undefined references errors even after taking care of environment\nvariables, we recommend doing a `cargo clean` and re-running `cargo build` or `cargo test`.\n\nYou can also use some environment variables mentioned in our [book][23], such as `AF_PRINT_ERRORS`\nto print more elaborate error messages to console.\n\n## Acknowledgements\n\nThe ArrayFire library is written by developers at [ArrayFire][14] LLC with [contributions][15]\nfrom several individuals. The developers at ArrayFire LLC have received partial financial support\nfrom several grants and institutions. Those that wish to receive public acknowledgement are listed\nbelow:\n\n### Grants\n\nThis material is based upon work supported by the DARPA SBIR Program Office under Contract Numbers\nW31P4Q-14-C-0012 and W31P4Q-15-C-0008. Any opinions, findings and conclusions or recommendations\nexpressed in this material are those of the author(s) and do not necessarily reflect the views of\nthe DARPA SBIR Program Office.\n\n[1]: https://github.com/arrayfire/arrayfire\n[2]: https://github.com/arrayfire/arrayfire-rust/issues\n[3]: http://arrayfire.github.io/arrayfire-rust/arrayfire/index.html\n[4]: https://join.slack.com/t/arrayfire-org/shared_invite/MjI4MjIzMDMzMTczLTE1MDI5ODg4NzYtN2QwNGE3ODA5OQ\n[5]: https://github.com/arrayfire/arrayfire-rust/discussions\n[6]: http://meritbadge.herokuapp.com/arrayfire\n[7]: https://crates.io/crates/arrayfire\n[8]: https://docs.rs/arrayfire/badge.svg\n[9]: https://docs.rs/arrayfire\n[10]: https://arrayfire.com/download\n[11]: https://github.com/arrayfire/arrayfire/wiki/Build-Instructions-for-Linux\n[12]: https://github.com/arrayfire/arrayfire/wiki/Build-Instructions-for-OSX\n[13]: https://github.com/arrayfire/arrayfire/wiki/Build-Instructions-for-Windows\n[14]: https://arrayfire.com/\n[15]: https://github.com/arrayfire/arrayfire_rust/graphs/contributors\n[16]: https://github.com/arrayfire/arrayfire-rust/actions?workflow=CI\n[17]: https://img.shields.io/badge/arrayfire-community-e69138?logo=slack\n[18]: https://img.shields.io/badge/arrayfire-Docs-blue?logo=readthedocs\n[19]: https://github.com/arrayfire/arrayfire-rust/workflows/ci/badge.svg?event=push\n[20]: https://img.shields.io/badge/GitHub-Discussions-orange\n[21]: http://arrayfire.org/arrayfire-rust/book/index.html\n[22]: https://img.shields.io/badge/arrayfire-mdbook-073763?logo=readthedocs\n[23]: http://arrayfire.org/arrayfire-rust/book/configuring_arrayfire_environment.html\n","funding_links":[],"categories":["Libraries","Table of Contents","Rust","库 Libraries","库","Machine Learning"],"sub_categories":["Computation","Tools and Development","计算 Computation","计算"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrayfire%2Farrayfire-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farrayfire%2Farrayfire-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrayfire%2Farrayfire-rust/lists"}