Closed jf003320018 closed 6 years ago
There're some remaining longs in the csrc that caused this problem. I replaced almost all of them into int64_t except the one in the template definition of python_function.cpp and then the problem was solved. BTW: All of the test cases passed including CUDA except multiprocessing.
@tylergenter I just tried compiling your fork on Python 3.5 (anaconda) with VS2015 and am getting test failures and a bunch of warnings.
and then Cannot open include file: 'TH.h'
and LINK : fatal error LNK1181: cannot open input file 'c:\dev\pytorch\torch\lib\tmp_install\lib\libopenblas.lib' [C:\dev \pytorch\torch\lib\build\TH\TH.vcxproj]
edit: I found compiled binaries of OpenBLAS here http://www.openblas.net/, any chance those might work instead of compiling them ourselves via cygwin?
It seems that @peterhj has successfully built and run pytorch. I also tested it with opennmt. So will pytorch provide official Windows support next? Thanks.
my platform base windows, still waiting pytorch windows version.
I've built a conda package of PyTorch for Windows 10 x64, Anaconda3(Python 3.5/3.6) and CUDA 8.0. Use this command to install if you want.
# for CPU only package (also for AMD and Intel Graphics since these GPUs are unsupported)
conda install -c peterjc123 pytorch-cpu
# for Windows 10 and Windows Server 2016, CUDA 8
conda install -c peterjc123 pytorch
# for Windows 10 and Windows Server 2016, CUDA 9
conda install -c peterjc123 pytorch cuda90
# for Windows 7/8/8.1 and Windows Server 2008/2012, CUDA 8
conda install -c peterjc123 pytorch_legacy
Note that the support for sm_20
and sm_30
has been dropped, so some old cards can't use PyTorch any more.
If you fail to import torch, try to install it in a new virtual environment like this:
conda create -n test python=3.6
activate test
Use it with caution, the multiprocessing part is broken so you need to wrap the main code with the following code if you use GPU and DataLoader.
if __name__ == '__main__':
If you can understand Chinese, here is my tutorial.
I just installed the build from peterjc123 - it's working! Note that if you try to use the package in Python 3.6.0, you will get an error upon import. Once I upgraded to 3.6.1 everything ran smoothly. This seems to be a common issue
I confirm the build by @peterjc123 is working. Great job!
this is great @peterjc123 !!!
Congratulations to @peterjc123 for his great effort. I just hope the Developers would start showing some love towards Windows after this...
Well we're not going to be officially supporting Windows, just because none of us has experience with developing Windows libraries, we don't have machines for setting up Windows contbuilds, etc. Still, we're going to accept PRs that fix Windows compatibility.
Doesn't the above windows build prevent 32 bit builds on every platform? (assuming those ever worked)
32-bit builds've never worked, and pytorch/torch has never correctly supported 32-bit.
Is there a windows build of torchvision?
@shingte If you are using Anaconda, after activating your environment, you can directly use
conda install torchvision -c soumith
@tyathalae This results in
(dev) C:\Users\Oscar\Anaconda3>conda install --channel soumith torchvision
Fetching package metadata .............
PackageNotFoundError: Package missing in current win-64 channels:
- torchvision
The repository only hosts an osx and a linux version. Do you have a suggestion for getting around this?
@outterback: just pip install torchvision
D'oh. Thank you @bordingj .
I want to thank everybody who helped with this! It's working well AFAICT. Hopefully it will be rolled into the official build.
Hi guys, is there a link to the unofficial build for Windows?
Thanks for the work done :). Hopefully the changes made by @tylergenter, @peterjc123 and others here will be merged to the main repo soon so the Windows support (though not official) is not left behind.
@saulthu Agree!
@Moondra Maybe I am not understanding what you're asking. But the method to install the Windows build is above,, namely: conda install -c peterjc123 pytorch=0.1.12 Once that's done you can optinally add torchvision with: pip install torchvision
@emulvihill Thank you =). Yeah I wanted to know how to install pytorch.;I was thinking I need to download a .whl
file
After reinstalling one of the unused PCs into Windows 8.1, I compiled a package for legacy windows versions such as Windows 7, 8/8.1 and Server 2008/2012. You can install that through the command below.
conda install -c peterjc123 pytorch_legacy
P.S. still needs CUDA 8.0 and Anaconda3(Python 3.6.1)
@peterjc123 you are doing really great work. i want to get pytorch master to be windows ready and then i can setup circle-ci contbuilds, atleast for release candidates. did you have to make significant changes to master to compile pytorch on windows? what do you think is the best plan to merge these back
The changes mainly fall into four categories:
There's no big problem for merging, but i can't confirm that works on Linux/Mac. Maybe i can try creating a PR and see whether the code works on Linux/Mac OS. If it works, then the Windows branch can be moved into the main repo. Finally, the Windows branch can be merged into the master branch. The PR is #1786 for your information.
@peterjc123 Hi, thanks for your works!! It helps me a lot. But I find that the functional doesn't have some common function like cosine similarity, etc. Will the conda package update?
@danche354 No, there won't be new conda packages until the Windows branch is merged into the pytorch master branch.
$ conda install -c peterjc123 pytorch=0.1.12
The following NEW packages will be INSTALLED:
pytorch: 0.1.12-py36_0.1.12cu80 peterjc123
Proceed ([y]/n)? y
pytorch-0.1.12 100% |###############################| Time: 0:03:58 2.04 MB/s
Kudos! Like a charm!
Thank you @tylergenter @peterjc123 and everybody else envolved. great work!
What about pip?
Hi, recently I want to map the entire Anaconda folder to a Windows cluster. But it reports an error:
Traceback (most recent call last):
File "test.py", line 21, in <module>
input_emd = torch.cat((wb, bb), dim=2)
File "Z:\user\v\Anaconda3\lib\site-packages\torch\autograd\variable.py", line 837, in cat
return Concat.apply(dim, *iterable)
File "Z:\user\v\Anaconda3\lib\site-packages\torch\autograd\_functions\tensor.py", line 287, in forward
return torch.cat(inputs, dim)
RuntimeError: cuda runtime error (8) : invalid device function at D:\users\v-qizhou\pytorch\pytorch\torch\lib\THC\THCGeneral.c:833
THCudaCheck FAIL file=D:\users\v\pytorch\pytorch\torch\lib\THC\THCGeneral.c line=833 error=8 : invalid device function
The test code is:
# CUDA TEST
import torch
from torch.autograd import Variable
from torch import nn
x = torch.Tensor([1.0])
xx = x.cuda()
print(xx)
# CUDNN TEST
from torch.backends import cudnn
print(cudnn.is_acceptable(xx))
word_embedding = nn.Embedding(10, 300).cuda()
bio_embedding = nn.Embedding(10, 32).cuda()
# a batch of 2 samples of 4 indices each
word_input = Variable(torch.LongTensor([[1,2,4,5],[4,3,2,9]]).cuda())
bio_input = Variable(torch.LongTensor([[1,2,4,5],[4,3,2,9]]).cuda())
wb = word_embedding(word_input)
bb = bio_embedding(bio_input)
input_emd = torch.cat((wb, bb), dim=2)
print(input_emd.size())
loss = input_emd.sum()
print(loss)
loss.backward()
Is there any idea about this error? Thanks.
@magic282 What are the outputs of print(xx)
and print(cudnn.is_acceptable(xx))
? Sounds like either CUDA configuration is wrong or you have a very old GPU.
@tyathalae The output of print(cudnn.is_acceptable(xx))
is True. I compiled the package on a windows server 2012 R2 with K40, and deploy it on M40, which seems not to be very old.
If you compiled it for K40 (compute capability 3.5) without specifying TORCH_CUDA_ARCH_LIST to include M40 (compute capability 5.2), that would explain what you are seeing. export TORCH_CUDA_ARCH_LIST="3.5 5.2" before compiling (or however it is done on Windows).
To the official developers of PyTorch, I just want to point out that if you were to decide to find a way to officially support Windows, you would gain tremendous momentum and interest with this project because TensorFlow doesn't support Windows and Theano doesn't handle multi-GPU on Windows.
Is something blocking the merge of the Windows branch into master?
@ngimel Thank you! I will try.
@devinbostIL There are still changes that needs to be fixed in the PR https://github.com/pytorch/pytorch/pull/1786
The main blocker is that the PR has a few commits that have 26k lines changed. It's impossible for us to review. We can merge it once someone splits it into smaller, reviewable parts (think at least independent commits of size <1k lines)
I'm running Windows 10 x64 with CUDA 7.5 and Python 3.6.1, and I ran:
conda install -c peterjc123 pytorch=0.1.12
from a new conda environment, and I was able to run:
# CUDA TEST
import torch
from torch.autograd import Variable
from torch import nn
x = torch.Tensor([1.0])
xx = x.cuda()
print(xx)
# CUDNN TEST
from torch.backends import cudnn
print(cudnn.is_acceptable(xx))
word_embedding = nn.Embedding(10, 300).cuda()
bio_embedding = nn.Embedding(10, 32).cuda()
# a batch of 2 samples of 4 indices each
word_input = Variable(torch.LongTensor([[1,2,4,5],[4,3,2,9]]).cuda())
bio_input = Variable(torch.LongTensor([[1,2,4,5],[4,3,2,9]]).cuda())
wb = word_embedding(word_input)
bb = bio_embedding(bio_input)
input_emd = torch.cat((wb, bb), dim=2)
print(input_emd.size())
loss = input_emd.sum()
print(loss)
loss.backward()
without any errors (to my astonishment).
@devinbostIL Thanks for your test. I can also run this test on my K40 server. The error occurs on the M40 cluster node. I guess it is my build option problem since I install a fresh anaconda and directly install the peterjc123 conda package and it can be deployed on the cluster node.
Hello. I am looking for no GPU pytorch version (for studying purpose). Are there any modifications for this case in the following command? conda install -c peterjc123 pytorch=0.1.12
@LyubomyrD You should be fine with that command. The PyTorch tutorials are all pretty clear on how/when things are shifted over to the GPU, so you can just install as usual, and avoid those steps.
I made a precompiled binaries for PyTorch with CUDA for Python 3.5 on Windows x64 here if you guys are interested.
@Phylliida Thank you for your contribution.
@devinbostIL What do you mean TensorFlow doesn't support Windows?
@DeepLearningJohnDoe I stand corrected. It looks like TensorFlow finally supports Windows, which surprises me because I remember they were having major issues with Bazel's heavy requirements on symlinks.
Hope pytorch can support Windows officially later. :smile:
I think pytorch should add Windows support. Other deep learning frameworks, like tensorflow, theano and mxnet, all support Windows. I only use Windows in my work. So I want to know whether pytorch will support Windows in future.