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

[Infra] #7 PyTorch 결여 1차대안 : PyTorch3D 소스코드 빌드 #8

Closed
oMFDOo opened this issue Nov 22, 2024 · 5 comments
Closed

Comments

@oMFDOo
Copy link
Owner

oMFDOo commented Nov 22, 2024

#7 문제 해결을 위한 1차 대안으로 PyTorch3D 최신 소스코드 빌드를 통한 CUDA 12.6 버전 지원 과정이다.

@oMFDOo
Copy link
Owner Author

oMFDOo commented Nov 22, 2024

공식 설치 가이드에 따라 진행해보고자 한다.

나는 가상환경, cuda, torch는 모두 구성되어 있기에 다음 단계부터 진행했다.

conda install -c iopath iopath

Image

CUB 설치

CUDA 11.7 이후 버전을 이용중이기에 아래 명령어로 정했다.

mkdir CUB
curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz
tar xzf 1.10.0.tar.gz

Image


vi ~/.bashrc
export CUB_HOME=/home/azureuser/GaussianHeadAvatar/CUB/cub-1.10.0
source ~/.bashrc

Image

@oMFDOo
Copy link
Owner Author

oMFDOo commented Nov 22, 2024

오류 뿜뿜이

facebookresearch/pytorch3d#1518 (comment)
: 해당 내용을 참고하여 추가적인 C 관련 종속성을 추가하였다.

Image


아직 오류 그대로

pip install -e .

Image

@oMFDOo
Copy link
Owner Author

oMFDOo commented Nov 22, 2024

많은 이의 은총을 받은 Discussions 참조

facebookresearch/pytorch3d#1752 (comment)

일단 대강 짜놨던 testCuda.py로 pytorch 버전을 확인했다.

import torch
print(f"PyTorch Version: {torch.__version__}")
print(f"Is CUDA available: {torch.cuda.is_available()}")
print(f"CUDA Version: {torch.version.cuda}")

Image



적어준 양식에 따라 설치를 해보았다.

pip install --extra-index-url https://miropsota.github.io/torch_packages_builder pytorch3d==0.7.8+pt2.4.1cu121

Image

Image
일단 이렇게는 동작을 함을 확인함

@oMFDOo
Copy link
Owner Author

oMFDOo commented Nov 22, 2024

찾았다 요녀석

: 나는 conda를 쓴다는 것을 항상 잊지말자...

libtorch_cuda_cu.so 경로 직접 탐색

find ~/anaconda3/envs/ -name "libtorch_cuda_cu.so"

Image


심볼릭 링크 연결 대상 탐색

: conda 내부에 설치된 3D torch 관련 탐색

find ~/anaconda3/envs/generate3d/ -name "libtorch"*

Image


심볼릭 링크 연결

# 출발지
SOURCE_DIR=~/anaconda3/envs/generate3d/lib/python3.8/site-packages

# 도착지
TARGET_DIR=/usr/local/cuda-12.6/lib64

# 심볼릭 링크 생성
sudo ln -s ${SOURCE_DIR}/torch/lib/libtorch.so ${TARGET_DIR}/libtorch.so
sudo ln -s ${SOURCE_DIR}/torch/lib/libtorch_python.so ${TARGET_DIR}/libtorch_python.so
sudo ln -s ${SOURCE_DIR}/torch/lib/libtorch_cuda_linalg.so ${TARGET_DIR}/libtorch_cuda_linalg.so
sudo ln -s ${SOURCE_DIR}/torch/lib/libtorch_cuda.so ${TARGET_DIR}/libtorch_cuda.so
sudo ln -s ${SOURCE_DIR}/torch/lib/libtorch_cpu.so ${TARGET_DIR}/libtorch_cpu.so
sudo ln -s ${SOURCE_DIR}/torch/lib/libtorch_global_deps.so ${TARGET_DIR}/libtorch_global_deps.so
sudo ln -s ${SOURCE_DIR}/torchaudio/lib/libtorchaudio.so ${TARGET_DIR}/libtorchaudio.so
sudo ln -s ${SOURCE_DIR}/torchaudio/lib/libtorchaudio_sox.so ${TARGET_DIR}/libtorchaudio_sox.so

# 검증
ls -l /usr/local/cuda-12.6/lib64

Image

@oMFDOo
Copy link
Owner Author

oMFDOo commented Nov 22, 2024

다음 오류 발생으로 일단 PyTorch3D 소스코드 빌드 이슈는 종료됨

Image

This was referenced Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant