Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

rebuild for torch-sys is triggered everytime #596

Closed
doofin opened this issue Dec 25, 2022 · 3 comments
Closed

rebuild for torch-sys is triggered everytime #596

doofin opened this issue Dec 25, 2022 · 3 comments

Comments

@doofin
Copy link

doofin commented Dec 25, 2022

Hi, I have exported LD_LIBRARY_PATH and LIBTORCH as required and have a working tch-rs with cuda . However everytime I tried to run tests, torch-sys is rebuild ("Compiling torch-sys v0.10.0") which takes long time.

However,It works fine on my other pc without setting env vars for LIBTORCH with only cpu

maybe relevant to this PR : #184

@LaurentMazare
Copy link
Owner

Thanks for reporting this, I have to say that I observed some similar behavior where rebuilding is triggered more often than what seems necessary and it's a bit of a pain as it's quite slow to build. It might be worth digging into this, I'm not really sure where this would come from, LIBTORCH is marked as cargo:rerun-if-env-changed so that should only trigger if the value of the environment variable actually changes (documentation) but maybe there is some issue around this.

@mawallace
Copy link

This was happening to me and I tracked it down to rust-analyzer. I believe what was happening is that rust-analyzer was calling cargo commands without the environment variables I had set in my shell and invalidating the cache. I was able to fix this by adding the environment variables to VSCode settings (where rust-analyzer is running as an extension):

"rust-analyzer.cargo.extraEnv": {
    "LIBTORCH": "/root/miniconda/lib/python3.10/site-packages/torch",
    "LD_LIBRARY_PATH": "/root/miniconda/lib/python3.10/site-packages/torch/lib",
    "LIBTORCH_CXX11_ABI": "0"
}

I'm not sure if you are using rust-analysizer or if this is what was causing your issues, but hopefully it's helpful.

@LaurentMazare
Copy link
Owner

An entry in the FAQ has been added so that it's easier to find this issue if needed, so closing this for now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants