changwoonchoi / 3Doodle

Official implementation of 3Doodle: Compact Abstraction of Objects with 3D Strokes (SIGGRAPH 24', Journal track)
https://changwoonchoi.github.io/3Doodle/
Other
71 stars 6 forks source link

Ubuntu 22.04 + CUDA 1.24 notes #9

Closed dawnofclarity closed 1 month ago

dawnofclarity commented 1 month ago

Hi folks,

I've got this running on Ubuntu 22.04 + CUDA 1.24 as part of my research. Given this OS/CUDA combo is a fairly standard setup at the moment, I thought other users/researchers might appreciate some of the additional checks / hints I needed to get it going.

First steps - check your driver version supports at least the level of CUDA you want to use. nvidia-smi

It displays at the top left the max CUDA version supported by the current driver

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.28.03              Driver Version: 560.28.03      CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
...

Install the relevant version of CUDA you want to use - in my case CUDA 12.4 Then validate it is installed / active with nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:18:24_PDT_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0

Now from the original instructions:

conda env create -f environment.yml

Edit activate.sh as needed. I changed it as follows:

conda activate 3Doodle

export PATH="/usr/local/cuda-12.4/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH"
export CUDA_HOME=/usr/local/cuda-12.4

Run the script source activate.sh

At this point make sure the installed torch version is for the version of CUDA you want to use. You can check this via: python -m torch.utils.collect_env

If not, uninstall it and install the relevant version.

pip3 uninstall torch torchvision torchaudio
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

Continuing the original instructions:

pip install git+https://github.com/openai/CLIP.git
pip install open3d
pip install git+https://github.com/jonbarron/robust_loss_pytorch
git clone https://github.com/BachiLi/diffvg
cd diffvg
git submodule update --init --recursive
python setup.py install
cd ..

At this point check the correct version of libstdc++.so.6 is installed as required by diffvg. strings <your-homedir>/anaconda3/envs/3Doodle/lib/libstdc++.so.6 | grep GLIBCXX_3.4.30 If nothing is returned you prob. have an older version, and diffvg will not run.

I tried updating the relevant package, but that just destroyed the whole install, so instead I went with the direct approach:

cd <your-homedir>/anaconda3/envs/3Doodle/lib
mv libstdc++.so.6 libstdc++.so.6.old        # keep old version, to allow roll back if needed.
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
cd -

You can validate this by running the string command again.

Now continue. I chose to install the latest stable pytorch, and let it generate a local wheel (slow, but guaranteed to match other installed packages). If you know the compatible wheel, you can specify that instead as per the original instructions.

pip install fvcore
pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
pip install -r requirements.txt
conda install -y scikit-image               # needed by some diffvg examples
pip install ninja                           # needed by the 3doodle viewer
pip install -e .

The model should now train using the original examples, and you can use the interactive viewer to inspect them.

Rgds, Dawn Raison PhD Sketch Researcher @ CVSSP / PAI (University of Surrey)

changwoonchoi commented 1 month ago

Thank you for your detailed instruction! It would be helpful to others as well!

changwoonchoi commented 1 month ago

I added link to this issue in the installation section of our README.md file. Thank you!