Comments (8)
Hi, thanks for reporting this issue. This is not enough information to help me debug your issue. Please fill out this template here: https://github.com/pytorch/pytorch/blob/master/.github/ISSUE_TEMPLATE.md and update your description so that I can better understand how to fix your problem.
from extension-cpp.
so this issue is solved?
from extension-cpp.
Sorry, I didn't see you had updated the issue. There was no response on my comment so I thought you had solved the issue.
from extension-cpp.
I will have to investigate this. I recall running into various issues with setup.py on windows. I believe pybind11 actually requires a custom CMake setup on Windows (see here) -- setuptools may not work out of the box.
from extension-cpp.
OK,thank you for your response, i will try pybind cmake first
from extension-cpp.
I tried pybind cmake example, it works for me, but i don't know how to incorporate pybind cmake to the pytorch cpp extension build system, could you please help me?
from extension-cpp.
Can you share your CMakeLists.txt? But all you'll really need is:
- Add the correct include paths from the
torch/lib/include
of you pytorch install (in site-packages): https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py#L240, - Add the include paths for CUDA (
$CUDA_HOME/include
), - Link in the correct ATen and CUDA libraries:
-lATen
and-lcudart
.
Essentially everything that https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py#L213 does.
from extension-cpp.
I use the following CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
project(lltm)
add_subdirectory(pybind11)
include_directories("C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Lib\site-packages\torch\lib\include")
include_directories(ENV{CUDA_PATH_V9_1}\include)
link_directories("C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Lib\site-packages\torch\lib")
pybind11_add_module(lltm src/lltm.cpp)
target_link_libraries(lltm PRIVATE ATen)
howerver, I still got the lnk 2001 error:
lltm.obj : error LNK2001: unresolved external symbole __imp_THPVariableClass
lltm.obj : error LNK2001: unresolved external symbole "struct _object * __cdecl THPVariable_Wrap(struct torch::autograd::Variable)" (?THPVariable_Wrap@@YAPEAU_object@@uvariab
le@autograd@torch@@@z)
from extension-cpp.
Related Issues (20)
- www.facebook.com/rozi.khatun.961
- This repo can not compile using Pytorch 1.6.0 HOT 1
- This repo can not compile using Pytorch 1.6.0 HOT 1
- A question about backward propagation speed in cpp extension in tutorial
- Error when building cpp extension HOT 1
- AttributeError: module 'depthwise' has no attribute 'forward'
- cuda does not install HOT 17
- How does the layer of C++ extensions translate to TorchScript or onnx? HOT 1
- Cannot Unpack, Too Many Items
- How to debug in cuda-pytorch env?
- Writing a custom C++ extension with variants for both CPU and GPU? HOT 2
- Custom CUDA operator only work well on cuda:0 HOT 3
- How can I access data in cuda kernel like in pytorch?
- error LNK2001 undefined reference to `__cudaRegisterLinkedBinary
- Relation between at::Half and __half
- Deprecation warning
- Scikit-build-core / scikit-build support for binding
- `TORCH_LIBRARY` and `m.def` Not Working as Documented
- [feature request] Instruction on how to setup compile-env for Windows
- JIT-compiling the extension results in non-functional Python module.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extension-cpp.