acids-ircam / ddsp_pytorch

Implementation of Differentiable Digital Signal Processing (DDSP) in Pytorch
Apache License 2.0
451 stars 56 forks source link

how to install for cpu only? #29

Open ahihi opened 3 years ago

ahihi commented 3 years ago

i'm trying to install the realtime Pd external on a linux machine which does have a cuda gpu, but i would like to experiment with inference on cpu. i'm doing:

conda create -n ddsp-pytorch python=3.8 cmake
conda activate ddsp-pytorch
pip install -r requirements.txt
cd realtime
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH=/home/sopi/miniconda3/envs/ddsp-pytorch/lib/python3.8/site-packages/torch -DCMAKE_BUILD_TYPE=Release

but cmake fails:

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr (found version "10.1")
-- Caffe2: CUDA detected: 10.1
-- Caffe2: CUDA nvcc is: /usr/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr
-- Caffe2: Header version is: 10.1
-- Could NOT find CUDNN (missing: CUDNN_LIBRARY_PATH CUDNN_INCLUDE_PATH)
CMake Warning at /home/sopi/miniconda3/envs/ddsp-pytorch/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:109 (message):
  Caffe2: Cannot find cuDNN library.  Turning the option off
Call Stack (most recent call first):
  /home/sopi/miniconda3/envs/ddsp-pytorch/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
  /home/sopi/miniconda3/envs/ddsp-pytorch/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:4 (find_package)

-- /usr/lib/x86_64-linux-gnu/libnvrtc.so shorthash is 5e8a26c9
-- Automatic GPU detection failed. Building for common architectures.
-- Autodetected CUDA architecture(s): 3.5;5.0;5.2;6.0;6.1;7.0;7.5;7.5+PTX
-- Added CUDA NVCC flags for: -gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_75,code=compute_75
CMake Error at /home/sopi/miniconda3/envs/ddsp-pytorch/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:96 (message):
  Your installed Caffe2 version uses cuDNN but I cannot find the cuDNN
  libraries.  Please set the proper cuDNN prefixes and / or install cuDNN.
Call Stack (most recent call first):
  /home/sopi/miniconda3/envs/ddsp-pytorch/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/sopi/ddsp_pytorch/realtime/build/CMakeFiles/CMakeOutput.log".
See also "/home/sopi/ddsp_pytorch/realtime/build/CMakeFiles/CMakeError.log".

i've tried editing requirements.txt to have pytorch>=1.7.0+cpu, but no luck.

alternatively, i've tried getting cpu-only pytorch from conda:

conda create -c pytorch -n ddsp-pytorch python=3.8 'pytorch>=1.7.0' cpuonly cmake

this gets me further; i can build and install ddsp~.pd_linux. but attempting to create a ddsp~ object in Pd fails with an undefined mkl symbol:

/home/sopi/Documents/Pd/externals/ddsp~.pd_linux: /home/sopi/miniconda3/envs/ddsp-pytorch/lib/python3.8/site-packages/torch/lib/../../../../libmkl_gnu_thread.so: undefined symbol: mkl_graph_mxm_gus_phase2_plus_second_fp32_def_i64_i32_fp32
 ddsp~
... couldn't create

not sure where to go from here. the conda environment does have mkl 2021.3.0 installed, do i need a different version?