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

WIP CUDA 11.7 support #150

Closed
wants to merge 5 commits into from
Closed

WIP CUDA 11.7 support #150

wants to merge 5 commits into from

Conversation

mxsrc
Copy link

@mxsrc mxsrc commented Sep 30, 2022

This branch contains changes to make Pedestron work with CUDA 11.7.

IMPORTANT: This is not mergeable, as it breaks compilation for lower versions of CUDA and PyTorch, and it is not a trivially usable version, but it works for me, so I figured I'd share it here for reference & potential improvement by others.

I was trying to get Pedestron running and after struggling with older CUDA versions and compatibility to Ampere GPUs I figured I'd give porting the Code to the newer version instead a go, which in the end worked.

Deployment

Environment

Run on Debian 11 with CUDA 11.7 and a RTX3060Ti.

I created a virutalenv for the dependencies.

package list ``` ⇒ pip3 freeze addict==2.4.0 certifi==2022.9.24 charset-normalizer==2.1.1 contourpy==1.0.5 cycler==0.11.0 Cython==0.29.32 fonttools==4.37.3 idna==3.4 kiwisolver==1.4.4 matplotlib==3.6.0 mmcv==0.2.10 mmdet==0.6.0+746cdce mmengine==0.1.0 numpy==1.23.3 opencv-python==4.6.0.66 packaging==21.3 Pillow==9.2.0 pycocotools==2.0.5 pyparsing==3.0.9 python-dateutil==2.8.2 PyYAML==6.0 requests==2.28.1 scipy==1.9.1 six==1.16.0 termcolor==2.0.1 terminaltables==3.1.10 torch==1.13.0.dev20220929+cu117 torchvision==0.14.0.dev20220929+cu117 typing-extensions==4.3.0 urllib3==1.26.12 yapf==0.32.0 ```

torch and torchvision had to be installed via pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu117/torch_nightly.html, I read that the torch+cu117 syntax should work to, but it didn't for me.

Building

Activate the venv and run:

python3 setup.py install

As a workaround for pip3 install . which didn't work, as the build environment was different from the venv.

Execution

Run the demo as described in the project readme.

Hints for integration

This is a very rough changeset, little more than a proof of concept.
If someone were to try and refine it into proper support for more versions of CUDA & PyTorch, here are some hints for how to do that.

I applied three groups of changes to make Pedestron work with my CUDA & PyTorch versions:

along with some changes to the project setup.

The circular dependency issue may well be a non-issue due to the tools/demo.py import of the current working directory over the installed one which (I think) I removed later.
The changes to CUDA & C++ code should be sanitized by providing headers which define appropriate functions/macros depending on the detected CUDA/PyTorch versions.
Moreover, someone with actual understanding should validate that there are no sideeffects introduced by the changes.
Lastly, I started changing the project description in pyproject.toml and setup.py to be more self-contained, currently these files don't reflect reality when it comes to supported versions, these should be explicitly encoded (e.g., there seems to be a PyTorch version beyond which the current code-base doesn't work, also I constrained mmcv to 0.2.10 because that worked for be, probably there's more versions that will work), s.t. the package can be more easily deloyed.

@hasanirtiza
Copy link
Owner

Appreciate the effort. I think for the moment it is best that, we either create a section in installation file, with your instructions or simply provide a link to this PR.

@mxsrc
Copy link
Author

mxsrc commented Oct 2, 2022

Sure, I opened this PR for sharing/documentation only in case it helps anyone.

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

Successfully merging this pull request may close these issues.

2 participants