Upload custom_rasterizer-0.1.0+torch251.cuda124-cp311-cp311-win_amd64.whl
Browse filesComfyUI-Hunyuan3DWrapper
E:\ComfyUI\custom_nodes\ComfyUI-Hunyuan3DWrapper\hy3dgen\texgen\custom_rasterizer\dist
Modifying the setup.py file
This Python script (setup.py) is used to build and install a custom rasterizer module that leverages CUDA for GPU acceleration. Here's a breakdown:
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import torch
torch_version = torch.__version__.split('+')[0].replace('.', '')
if torch.version.cuda is not None:
cuda_version = "cuda" + torch.version.cuda.replace('.', '')
elif getattr(torch.version, 'hip', None) is not None:
cuda_version = "rocm" + torch.version.hip.replace('.', '')
version = f"0.1.0+torch{torch_version}.{cuda_version}"
custom_rasterizer_module = CUDAExtension('custom_rasterizer_kernel',
[
'lib/custom_rasterizer_kernel/rasterizer.cpp',
'lib/custom_rasterizer_kernel/grid_neighbor.cpp',
'lib/custom_rasterizer_kernel/rasterizer_gpu.cu',
], extra_compile_args={'nvcc': ['-arch=sm_89']}) # Set in CUDAExtension
setup(
packages=find_packages(),
version=version,
name='custom_rasterizer',
include_package_data=True,
package_dir={'': '.'},
ext_modules=[
custom_rasterizer_module,
],
cmdclass={
'build_ext': BuildExtension
},
)
Import necessary libraries:
setuptools: For packaging and distribution.
torch.utils.cpp_extension: For building C++/CUDA extensions for PyTorch.
torch: The PyTorch library.
Determine PyTorch and CUDA/ROCm versions:
The code extracts the PyTorch version and determines whether a CUDA or ROCm environment is available, then also extracts the version number of those.
This is used to generate a dynamic version string for the package.
Define the CUDA extension:
CUDAExtension is used to compile the C++ and CUDA source files (rasterizer.cpp, grid_neighbor.cpp, rasterizer_gpu.cu).
extra_compile_args specifies the NVCC compiler flags, in this case, setting the target architecture to sm_89.
Set up the package:
setup() configures the package metadata, including:
packages: Automatically finds all packages in the project.
version: The dynamically generated version string.
name: The package name (custom_rasterizer).
ext_modules: The list of CUDA extensions to build.
cmdclass: Specifies that the BuildExtension command should be used to build the extensions.
Compilation Steps:
Save the modified setup.py file.
Open a command-line terminal and navigate to the custom_rasterizer directory.
Rerun the following commands:
Bash
python setup.py bdist_wheel
pip install dist/your_wheel_file_name.whl
The first command python setup.py bdist_wheel builds a wheel package (a distribution format for Python).
The second command pip install dist/your_wheel_file_name.whl installs the created wheel package. Be sure to replace your_wheel_file_name.whl with the actual name of the file that was created.
|
@@ -40,3 +40,4 @@ xformers-0.0.28.post3-cp311-cp311-win_amd64.whl filter=lfs diff=lfs merge=lfs -t
|
|
| 40 |
kaolin-0.17.0-cp311-cp311-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
| 41 |
spconv-2.3.8-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
| 42 |
diff_gaussian_rasterization-0.0.0-cp311-cp311-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 40 |
kaolin-0.17.0-cp311-cp311-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
| 41 |
spconv-2.3.8-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
| 42 |
diff_gaussian_rasterization-0.0.0-cp311-cp311-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
custom_rasterizer-0.1.0+torch251.cuda124-cp311-cp311-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa2701a57aa448ed14416b93a80d27a9f7736f42a5758204471f0f090bfeb35e
|
| 3 |
+
size 135712
|