euro-hpc-pl / setuptools_cuda

Setuptools plugin for compiling CUDA-enable extension modules
2 stars 0 forks source link

Hi~, good idea but not perfect #3

Open szuboy opened 1 year ago

szuboy commented 1 year ago

I recently had to use setuptools for CUDA compilation, and found it to be a frustrating task. Setuptools_cuda couldn't address all of my concerns, but I was able to use torch's cpp_extension to complete the task, albeit imperfectly, because it had to rely on the large framework of torch.

Therefore, I recommend that the development of setuptools_cuda should take inspiration from torch's approach, making it as smooth to use as the native setuptools.

from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension

If you're in need of any assistance, please feel free to reach out to me as I have ample experience with Python CUDA compilation.

dexter2206 commented 1 year ago

Hello. Thanks for your interest in setuptools_cuda. We're open to improvement suggestions but, unfortunately, I couldn't understand what you are missing in this package. Can you prepare a minimal example demonstrating what problems you faced?

RafaelJVicente commented 1 year ago

Hello, i think this library is perfect for projects working on modern CUDA projects that only need a default configuration, but that is not the case for me (i saw a post of stack overflow pretty similar to this library and one of the problems I had is that i cannot compile mixed .cu and .cpp files for example), what's more, if you have strange installations like the one I have in an old PC where you may need to add specific architecture parameters. I use to have PyTorch installed but is a 800-900 MB project and the architecture I use in the old PC is already deprecated in Torch. I suppose that's what @szuboy refers to.

My library setuptools-cpp-cuda fix some of this problems and is partially based precisely in torch's cpp_extension adding support for older architectures and some more improvements and side fixes.

But just in case i think this library is perfect for fast developments and mine covers more complex or older architecture use cases.

szuboy commented 1 year ago

@RafaelJVicente I completely agree with you and I am eager to give setuptools_cpp_cuda a try to see if it resolves my issue. Thank you for suggesting this approach, and I will definitely provide feedback on my experience.

Your idea is truly excellent!

szuboy commented 1 year ago

Hello, i think this library is perfect for projects working on modern CUDA projects that only need a default configuration, but that is not the case for me (i saw a post of stack overflow pretty similar to this library and one of the problems I had is that i cannot compile mixed .cu and .cpp files for example), what's more, if you have strange installations like the one I have in an old PC where you may need to add specific architecture parameters. I use to have PyTorch installed but is a 800-900 MB project and the architecture I use in the old PC is already deprecated in Torch. I suppose that's what @szuboy refers to.

My library setuptools-cpp-cuda fix some of this problems and is partially based precisely in torch's cpp_extension adding support for older architectures and some more improvements and side fixes.

But just in case i think this library is perfect for fast developments and mine covers more complex or older architecture use cases.

sorry, it seems like setuptools-cpp-extension didn't solve my problem. Even though the setup.py can be compiled, I encountered some errors when trying to call it:

ImportError: /home/medai02/anaconda3/lib/python3.6/site-packages/xxxx-0+unknown-py3.6-linux-x86_64.egg/xxxx/_cmatrices.cpython-36m-x86_64-linux-gnu.so : undefined symbol: calculate_launcher

Do you have any suggestions on how to resolve this error? I appreciate your help.

RafaelJVicente commented 1 year ago

Hello, I have migrated the project to GitHub since I think it is more accessible and I've changed the name of the module from “setuptools-cpp-cuda” to setuptools-cuda-cpp becouse Pypi dont index the other one correctly. @szuboy I think is more useful if you can open the issue here just in case other users have the same problem. If possible, can u also send me the "tree" of your project and your setup.py, I don’t use Conda but I had similar issues due to the setuptools version in python 3.6. With that info I think I can help you to fix the problem. Ty in advance.

dexter2206 commented 1 year ago

@szuboy you still haven't shown exactly what the problem is when you try to use setuptools_cuda. Can you provide a minimal example demonstrating the problem so that we can assist you?