{"id":18968849,"url":"https://github.com/tttapa/cross-pytorch","last_synced_at":"2026-05-07T05:32:33.448Z","repository":{"id":240412426,"uuid":"799566738","full_name":"tttapa/cross-pytorch","owner":"tttapa","description":"Instructions for cross-compiling PyTorch with CUDA support on Linux.","archived":false,"fork":false,"pushed_at":"2024-05-18T16:56:03.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-01T07:09:17.044Z","etag":null,"topics":["cmake","cross-compilation","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/tttapa.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-12T14:27:20.000Z","updated_at":"2024-05-18T16:56:07.000Z","dependencies_parsed_at":"2024-05-18T17:46:00.986Z","dependency_job_id":"d2c1521b-e361-460e-8acc-4c01c02f1dfb","html_url":"https://github.com/tttapa/cross-pytorch","commit_stats":null,"previous_names":["tttapa/cross-pytorch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tttapa%2Fcross-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tttapa%2Fcross-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tttapa%2Fcross-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tttapa%2Fcross-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tttapa","download_url":"https://codeload.github.com/tttapa/cross-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239965876,"owners_count":19726209,"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":["cmake","cross-compilation","pytorch"],"created_at":"2024-11-08T14:48:38.214Z","updated_at":"2026-04-05T13:30:17.358Z","avatar_url":"https://github.com/tttapa.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cross-pytorch\n\nScripts for cross-compiling PyTorch with CUDA support on Linux.\n\n## Why?\n\nRecent PyTorch binaries no longer support glibc 2.28 and earlier, and can no\nlonger be compiled using older compilers.\n\n## How?\n\nThis repository has scripts that \n1. Download a suitable cross-compiler to make sure that the resulting binaries are compatible with Ubuntu 18.04 Bionic, Debian 10 Buster, Rocky 8 and later.\n2. Download a suitable version of CUDA.\n3. Cross-compile PyTorch and (some of) its dependencies with the rigth compiler and CUDA version.\n\n## Instructions\n\n- In `scripts/download-cuda.sh`, select the appropriate `cuda_version` and `cudnn_version` (the former should be compatible with your driver version, use `nvidia-smi` to verify the version you have installed).\n- In `scripts/install-torch.sh`, select the appropriate `CMAKE_CUDA_ARCHITECTURES` and `TORCH_CUDA_ARCH_LIST` options (see https://developer.nvidia.com/cuda-gpus).\n- In `scripts/install-torch.sh`, select the version of PyTorch you need (`main` by default).\n- You'll need a native C compiler, Python 3 and some standard tools like `wget` and `git`. Ccache is recommended and enabled by default, but can be commented out in `scripts/install-torch.sh`\n- Finally, run the following commands:\n```sh\n./install-toolchain.sh # ~120 MiB download\n./download-cuda.sh # ~2 GiB download\n./install-torch.sh # May take a couple of hours, dependening on your machine's performance\n```\n\nEverything is downloaded and built locally in the current folder. No root privileges are required.\nThe resulting PyTorch install tree can be found in `toolchains/x86_64-bionic-linux-gnu/pytorch`.\n\nAdd it to your `CMAKE_FIND_ROOT_PATH`, and use the `scripts/toolchains/x86_64-bionic-linux-gnu.cmake` toolchain file so CMake can locate CUDA correctly when building your own project. A CMake project and a `CMakePresets.json` file are provided as an example:\n\n```sh\ncmake --preset develop\ncmake --build build -j --config Release\nexport LD_LIBRARY_PATH=\"$PWD/toolchains/x-tools/x86_64-bionic-linux-gnu/x86_64-bionic-linux-gnu/lib64\"\n./build/Release/example-torch\n```\n\n## Further reading\n\n- https://pytorch.org/cppdocs/\n- https://pytorch.org/cppdocs/installing.html\n- https://pytorch.org/tutorials/advanced/cpp_frontend.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftttapa%2Fcross-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftttapa%2Fcross-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftttapa%2Fcross-pytorch/lists"}