Hello, I am using PyTorch 2.0 and having issues with torch.compile
I have installed the nightly build of torch using the instructions on the pytorch website with CUDA 11.7
# pytorch install command
❯ conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch-nightly -c nvidia
# confirming versions
❯ python -V
Python 3.10.8
❯ python -c 'import torch;print(torch.__version__)'
2.0.0.dev20230105
❯ conda list | grep cuda
cuda 11.7.1 0 nvidia
...
pytorch 2.0.0.dev20230105 py3.10_cuda11.7_cudnn8.5.0_0 pytorch-nightly
pytorch-cuda 11.7 h67b0de4_2 pytorch-nightly
When I try torch.compile
I get no issues with the first example provided in the docs
In [1]: import torch
...:
...: def foo(x, y):
...: a = torch.sin(x)
...: b = torch.cos(x)
...: return a + b
...: opt_foo1 = torch.compile(foo)
...: print(opt_foo1(torch.randn(10, 10), torch.randn(10, 10)))
# works !
However, trying the next example that uses a resnet18
model on GPU I get many errors of the following form
/tmp/tmpsov1pory/main.c:2:10: fatal error: cuda.h: No such file or directory
#include "cuda.h"
^~~~~~~~
compilation terminated.
This message prints ~ 30 times listing different tmp directories.
Is there a certain environment variable that needs to be set to allow torch to find cuda.h
. I tried running find /path/to/my/conda/env -name cuda.h
and adding the directories to my LD_LIBRARY_PATH
but still got the same error.
Please let me know if anyone can suggest what to troubleshoot next.
Thank you