Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix the caffe2_gpu linkage with torch on Windows #16071

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
6 participants
@peterjc123
Copy link
Contributor

commented Jan 16, 2019

@peterjc123

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2019

Should we add a test to check the linkage between caffe2_gpu and torch?

@facebook-github-bot
Copy link
Contributor

left a comment

@soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@soumith soumith added this to the 1.0.1 milestone Jan 16, 2019

@peterjc123 peterjc123 deleted the peterjc123:opt_fix branch Jan 17, 2019

peterjc123 added a commit to peterjc123/pytorch that referenced this pull request Jan 17, 2019

Fix the caffe2_gpu linkage with torch on Windows (pytorch#16071)
Summary:
Fixes pytorch#15992.
Inspired by https://docs.microsoft.com/en-us/cpp/build/reference/optimization-best-practices?view=vs-2017. But this PR needs to be tested.
Pull Request resolved: pytorch#16071

Differential Revision: D13693006

Pulled By: soumith

fbshipit-source-id: e83e9ae2591fa4da01d2b1b593558dba3bdc3cf7
@Alex18947

This comment has been minimized.

Copy link

commented May 31, 2019

Ok, the issue is back again.... After upgrading Pytorch from master and successfully building on Windows, the torch.lib and torch.dll libraries are empty (contain just one placeholder function), and linking against c10.lib, c10_cuda.lib, caffe2.lib and caffe2_gpu.lib works but makes the resulting binary depend only on c10.dll and caffe2.dll. As a result, torch::cuda::is_available() is always false.

Do we have the same problem again or am I missing something?

@peterjc123

This comment has been minimized.

Copy link
Contributor Author

commented May 31, 2019

@Alex18947 This is not a bug. We have deprecated the old torch library a few weeks ago in #17783 and will rename caffe2 library to torch in #20774. We are sorry for the inconvenience.

@Alex18947

This comment has been minimized.

Copy link

commented May 31, 2019

@peterjc123 Yes, I understand that this change is intentional. But does it mean that there is no way now to create a C++ app in Windows so that torch::cuda::is_available() returns true? If there is way, please suggest...

@peterjc123

This comment has been minimized.

Copy link
Contributor Author

commented May 31, 2019

@Alex18947 Yes I can reproduce this issue.
The result of the following code prints 0 in the nightly build.

std::cout << torch::cuda::is_available() << std::endl;

But this time it's not easy to get this fixed, because torch frontend is now included in caffe2, however, the aten cuda part is included in caffe2_gpu, which generates later than caffe2. The previous workground (adding a function that calls the other to establish the link) won't work for this case.
@ezyang @kostmo Any ideas?

@kostmo

This comment has been minimized.

Copy link
Member

commented May 31, 2019

In the next week or two, I plan to collapse caffe2 + caffe2_gpu (then renamed together as torch) into a single library: #20774 (review)

pull bot pushed a commit to Pandinosaurus/pytorch that referenced this pull request Jun 4, 2019

Revert "Fix the caffe2_gpu linkage with torch on Windows" (pytorch#21335
)

Summary:
The original PR (pytorch#16071) is not working anymore after `caffe2` and `torch` is unified. What's more, It is making the binary big since the optimizing flag is disabled on a very big project(the `torch` library used to be small, but it now applies on the whole `caffe2` and `caffe2_gpu` library). We need to get it reverted.
Pull Request resolved: pytorch#21335

Differential Revision: D15622163

Pulled By: soumith

fbshipit-source-id: 900bd400106d27a1512eed1e9f2288114f5f41bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.