{"id":13822351,"url":"https://github.com/EnzymeAD/oxide-enzyme","last_synced_at":"2025-05-16T15:34:07.916Z","repository":{"id":43152655,"uuid":"356676922","full_name":"EnzymeAD/oxide-enzyme","owner":"EnzymeAD","description":"Enzyme integration into Rust. Experimental, do not use.","archived":true,"fork":false,"pushed_at":"2023-02-24T01:12:13.000Z","size":134,"stargazers_count":102,"open_issues_count":2,"forks_count":3,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-08-04T08:08:15.388Z","etag":null,"topics":["ad","auto-differentiation","derivative","enzyme","gradient","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EnzymeAD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2021-04-10T19:36:06.000Z","updated_at":"2024-07-08T19:18:05.000Z","dependencies_parsed_at":"2024-01-18T03:48:57.447Z","dependency_job_id":null,"html_url":"https://github.com/EnzymeAD/oxide-enzyme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnzymeAD%2Foxide-enzyme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnzymeAD%2Foxide-enzyme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnzymeAD%2Foxide-enzyme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnzymeAD%2Foxide-enzyme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EnzymeAD","download_url":"https://codeload.github.com/EnzymeAD/oxide-enzyme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225436671,"owners_count":17474193,"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":["ad","auto-differentiation","derivative","enzyme","gradient","rust"],"created_at":"2024-08-04T08:01:56.348Z","updated_at":"2024-11-19T22:33:02.660Z","avatar_url":"https://github.com/EnzymeAD.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# \u003cimg src=\"https://enzyme.mit.edu/logo.svg\" width=\"75\" align=left\u003e ARCHIVED \n\n## Please look at https://github.com/EnzymeAD/rust\n\n\nThis is a package containing a Rust frontend for [Enzyme](https://github.com/wsmoses/enzyme). This is very much a work in progress and bug reports/discussion is greatly appreciated!\n\nEnzyme is a plugin that performs automatic differentiation (AD) of statically analyzable LLVM. It is highly-efficient and its ability perform AD on optimized code allows Enzyme to meet or exceed the performance of state-of-the-art AD tools.\n  \n# Supported types\n- Scalars  \n- Structs, Unions  \n- Tuple, Array, Vec  \n- Box, Reference, Raw pointer  \n\nWe are working on adding support for dyn trait objects, slices and enums.  \nAdding Generics to your types or implementing traits is already working fine.\n\n\n# Setup\nFirst you have to get an adequate rustc/llvm/enzyme build here: [enzyme\\_build](https://github.com/ZuseZ4/enzyme\\_build).  \nAfterwards for your convenience you should export this path for LLVM_SYS\n\n```bash\n$ export LLVM_SYS_130_PREFIX=$HOME/.cache/enzyme/rustc-1.59.0-src/build/x86_64-unknown-linux-gnu/llvm  \n```\n\nand tell Enzyme about your library locations:  \n```bash\n$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.cache/enzyme/Enzyme-0.0.29/enzyme/build/Enzyme:$HOME/.cache/enzyme/rustc-1.59.0-src/build/x86_64-unknown-linux-gnu/llvm/build/lib/  \n```\n  \nAs an alternative you can also run   \n```bash\n$ ninja install  \n```\ninside of your enzyme and llvm build directory.\n\nAfterwards you can execute the following lines in `oxide-enzyme/example`, in order to compile the example.\n```bash\n$ cargo enzyme\n```\nYou will find your executable in `./target/$TARGET/debug/`\n\n# Compilation\nWe generate gradient functions based on LLVM-IR code. Therefore we currently need two compilation runs. The first to generate\na llvm-bc file with the LLVM-IR code, the second to process the bc file, generate the gradients, and build the entire crate.\nYou can do that manually using \n```bash\nRUSTFLAGS=\"--emit=llvm-bc\" cargo +enzyme -Z build-std rustc --target x86_64-unknown-linux-gnu -- --emit=llvm-bc -g -C opt-level=3 -Zno-link \u0026\u0026 RUSTFLAGS=\"--emit=llvm-bc\" cargo +enzyme -Z build-std rustc --target x86_64-unknown-linux-gnu -- --emit=llvm-bc -g -C opt-level=3\n```\nWe have created a wrapper for this command which you can call with:\n```bash\ncargo enzyme\n```\nPlease be aware that our wrapper will ignore all additional commands.  \nThis approach won't work on dependencies since cargo doesn't support such a build process.\n\n\n\n# FAQ  \n- Q: How about Windows / Mac?\n- A: WSL might work, the others probably not. Please let us know if you try.\n\n  \n# Further Information\nMore information on installing and using Enzyme directly (not through Rust) can be found on our website: [https://enzyme.mit.edu](https://enzyme.mit.edu).\n\nTo get involved or if you have questions, please join our [mailing list](https://groups.google.com/d/forum/enzyme-dev).\n\nIf using this code in an academic setting, please cite the following paper to appear in NeurIPS 2020\n\n```\n@inproceedings{NEURIPS2020_9332c513,\n author = {Moses, William and Churavy, Valentin},\n booktitle = {Advances in Neural Information Processing Systems},\n editor = {H. Larochelle and M. Ranzato and R. Hadsell and M. F. Balcan and H. Lin},\n pages = {12472--12485},\n publisher = {Curran Associates, Inc.},\n title = {Instead of Rewriting Foreign Code for Machine Learning, Automatically Synthesize Fast Gradients},\n url = {https://proceedings.neurips.cc/paper/2020/file/9332c513ef44b682e9347822c2e457ac-Paper.pdf},\n volume = {33},\n year = {2020}\n}\n```\n\nLicense\n=======\n\nDual-licensed to be compatible with the Rust project.\n\nLicensed under the Apache License, Version 2.0\nhttp://www.apache.org/licenses/LICENSE-2.0 or the MIT license\nhttp://opensource.org/licenses/MIT, at your\noption. This file may not be copied, modified, or distributed\nexcept according to those terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEnzymeAD%2Foxide-enzyme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEnzymeAD%2Foxide-enzyme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEnzymeAD%2Foxide-enzyme/lists"}