Building v1.0.1 from source is failing on Ubuntu 18.04

Hi,

I have an old GPU (GTX660 with compute capability 3.0) and are trying to build pytorch v1.0.1 from source since v1.1 is not supporting cards with compute capability lower than 3.5.

I installed the nvidia-driver-418, cuda 10.1 and cudnn7.6.2. After the installation, the samples of the cuda installation as well as the samples of the cudnn installation worked flawlessly.

I followed the instructions for building pytorch from source, checked out v1.0.1 and installed conda and all its dependencies. To compile pytorch i ran the following command:

TORCH_CUDA_ARCH_LIST="3.0" python setup.py install

Then the building process starts and apparently cuda and cudnn is recognized. However after some time i get the following error:

error: ‘float* cblas_sgemm_alloc(CBLAS_IDENTIFIER, int, int, int)’ is deprecated [-Werror=deprecated-declarations]
                 weights(i, d, p) = cblas_sgemm_alloc(CblasAMatrix, m_p, n, k_p);
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

I attached the full output of the build process at the bottom. I already googled this error but I didn’t find any solution.

Does anyone had this issue and can help me?

Output of the build process:

Building wheel torch-1.0.0a0+8322165
running install
setup.py::run()
running build_deps
setup.py::build_deps::run()
+ SYNC_COMMAND=cp
++ command -v rsync
+ '[' -x /usr/bin/rsync ']'
+ SYNC_COMMAND='rsync -lptgoD'
+ CMAKE_COMMAND=cmake
++ command -v cmake3
+ [[ -x '' ]]
+ USE_CUDA=0
+ USE_FBGEMM=0
+ USE_ROCM=0
+ USE_NNPACK=0
+ USE_MKLDNN=0
+ USE_QNNPACK=0
+ USE_GLOO_IBVERBS=0
+ CAFFE2_STATIC_LINK_CUDA=0
+ RERUN_CMAKE=1
+ [[ 5 -gt 0 ]]
+ case "$1" in
+ USE_CUDA=1
+ shift
+ [[ 4 -gt 0 ]]
+ case "$1" in
+ USE_NNPACK=1
+ shift
+ [[ 3 -gt 0 ]]
+ case "$1" in
+ USE_MKLDNN=1
+ shift
+ [[ 2 -gt 0 ]]
+ case "$1" in
+ USE_QNNPACK=1
+ shift
+ [[ 1 -gt 0 ]]
+ case "$1" in
+ break
+ CMAKE_INSTALL='make install'
+ BUILD_SHARED_LIBS=ON
+ USER_CFLAGS=
+ USER_LDFLAGS=
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
++ uname
+ '[' Linux == Darwin ']'
+++ dirname ../tools/build_pytorch_libs.sh
++ cd ../tools/..
+++ pwd
++ printf '%q\n' /home/dominik/Desktop/pytorch
+ BASE_DIR=/home/dominik/Desktop/pytorch
+ TORCH_LIB_DIR=/home/dominik/Desktop/pytorch/torch/lib
+ INSTALL_DIR=/home/dominik/Desktop/pytorch/torch/lib/tmp_install
+ THIRD_PARTY_DIR=/home/dominik/Desktop/pytorch/third_party
+ C_FLAGS=
+ C_FLAGS=' -DOMPI_SKIP_MPICXX=1'
+ LDFLAGS=
+ LD_POSTFIX=.so
++ uname
+ [[ Linux == \D\a\r\w\i\n ]]
+ [[ 0 -eq 1 ]]
+ LDFLAGS=' -Wl,-rpath,$ORIGIN'
+ CPP_FLAGS=' -std=c++11 '
+ THD_FLAGS=
+ [[ 0 -eq 1 ]]
+ CUDA_NVCC_FLAGS=' -DOMPI_SKIP_MPICXX=1'
+ [[ -z '' ]]
+ CUDA_DEVICE_DEBUG=0
+ '[' -z '' ']'
++ getconf _NPROCESSORS_ONLN
+ MAX_JOBS=4
+ BUILD_TYPE=Release
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo 'Building in Release mode'
Building in Release mode
+ mkdir -p /home/dominik/Desktop/pytorch/torch/lib/tmp_install
+ for arg in "$@"
+ [[ caffe2 == \c\a\f\f\e\2 ]]
+ build_caffe2
+ [[ -z '' ]]
+ EXTRA_CAFFE2_CMAKE_FLAGS=()
+ [[ -n '' ]]
+ [[ -n /home/dominik/anaconda3;/home/dominik/anaconda3/lib/python3.7/site-packages ]]
+ EXTRA_CAFFE2_CMAKE_FLAGS+=("-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH")
+ [[ 1 -eq 1 ]]
+ cmake /home/dominik/Desktop/pytorch -DPYTHON_EXECUTABLE=/home/dominik/anaconda3/bin/python -DPYTHON_LIBRARY=/home/dominik/anaconda3/lib/libpython3.7m.so.1.0 -DPYTHON_INCLUDE_DIR=/home/dominik/anaconda3/include/python3.7m -DBUILDING_WITH_TORCH_LIBS=ON -DTORCH_BUILD_VERSION=1.0.0a0+8322165 -DCMAKE_BUILD_TYPE=Release -DBUILD_TORCH=ON -DBUILD_PYTHON=ON -DBUILD_SHARED_LIBS=ON -DBUILD_BINARY=OFF -DBUILD_TEST=ON -DINSTALL_TEST=ON -DBUILD_CAFFE2_OPS=ON -DONNX_NAMESPACE=onnx_torch -DUSE_CUDA=1 -DUSE_DISTRIBUTED=ON -DUSE_FBGEMM=0 -DUSE_NUMPY= -DNUMPY_INCLUDE_DIR=/home/dominik/anaconda3/lib/python3.7/site-packages/numpy/core/include -DUSE_SYSTEM_NCCL=OFF -DNCCL_INCLUDE_DIR= -DNCCL_ROOT_DIR= -DNCCL_SYSTEM_LIB= -DCAFFE2_STATIC_LINK_CUDA=0 -DUSE_ROCM=0 -DUSE_NNPACK=1 -DUSE_LEVELDB=OFF -DUSE_LMDB=OFF -DUSE_OPENCV=OFF -DUSE_QNNPACK=1 -DUSE_FFMPEG=OFF -DUSE_GLOG=OFF -DUSE_GFLAGS=OFF -DUSE_SYSTEM_EIGEN_INSTALL=OFF -DCUDNN_INCLUDE_DIR=/usr/include/ -DCUDNN_LIB_DIR=/usr/lib/x86_64-linux-gnu/ -DCUDNN_LIBRARY=/usr/lib/x86_64-linux-gnu/libcudnn.so.7 -DUSE_MKLDNN=1 -DNCCL_EXTERNAL=1 -DCMAKE_INSTALL_PREFIX=/home/dominik/Desktop/pytorch/torch/lib/tmp_install -DCMAKE_C_FLAGS= -DCMAKE_CXX_FLAGS= '-DCMAKE_EXE_LINKER_FLAGS= -Wl,-rpath,$ORIGIN ' '-DCMAKE_SHARED_LINKER_FLAGS= -Wl,-rpath,$ORIGIN ' -DTHD_SO_VERSION=1 '-DCMAKE_PREFIX_PATH=/home/dominik/anaconda3;/home/dominik/anaconda3/lib/python3.7/site-packages'
-- std::exception_ptr is supported.
-- NUMA is disabled
-- Turning off deprecation warning due to glog.
-- Current compiler supports avx2 extension. Will build perfkernels.
-- Current compiler supports avx512f extension. Will build fbgemm.
-- Building using own protobuf under third_party per request.
-- Use custom protobuf build.
-- Caffe2 protobuf include directory: $<BUILD_INTERFACE:/home/dominik/Desktop/pytorch/third_party/protobuf/src>$<INSTALL_INTERFACE:include>
-- The BLAS backend of choice:MKL
-- Checking for [mkl_intel_lp64 - mkl_gnu_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_intel_lp64: /home/dominik/anaconda3/lib/libmkl_intel_lp64.so
--   Library mkl_gnu_thread: /home/dominik/anaconda3/lib/libmkl_gnu_thread.so
--   Library mkl_core: /home/dominik/anaconda3/lib/libmkl_core.so
-- Found OpenMP_C: -fopenmp  
-- Found OpenMP_CXX: -fopenmp  
-- Found OpenMP: TRUE   
--   Library gomp: -fopenmp
--   Library pthread: /usr/lib/x86_64-linux-gnu/libpthread.so
--   Library m: /usr/lib/x86_64-linux-gnu/libm.so
--   Library dl: /usr/lib/x86_64-linux-gnu/libdl.so
-- Brace yourself, we are building NNPACK
-- Found PythonInterp: /home/dominik/anaconda3/bin/python (found version "3.7.3") 
-- Failed to find LLVM FileCheck
-- git Version: v1.4.0-505be96a
-- Version: 1.4.0
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Using third party subdirectory Eigen.
Python 3.7.3
-- Found PythonInterp: /home/dominik/anaconda3/bin/python (found suitable version "3.7.3", minimum required is "2.7") 
-- Could NOT find pybind11 (missing: pybind11_DIR)
-- Could NOT find pybind11 (missing: pybind11_INCLUDE_DIR) 
-- Using third_party/pybind11.
-- Found CUDA: /usr/local/cuda (found suitable version "10.1", minimum required is "7.0") 
-- Caffe2: CUDA detected: 10.1
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 10.1
-- Found cuDNN: v7.6.2  (include: /usr/include/, library: /usr/lib/x86_64-linux-gnu/libcudnn.so.7)
CMake Warning at cmake/public/utils.cmake:169 (message):
  In the future we will require one to explicitly pass TORCH_CUDA_ARCH_LIST
  to cmake instead of implicitly setting it as an env variable.  This will
  become a FATAL_ERROR in future version of pytorch.
Call Stack (most recent call first):
  cmake/public/cuda.cmake:349 (torch_cuda_get_nvcc_gencode_flag)
  cmake/Dependencies.cmake:656 (include)
  CMakeLists.txt:201 (include)


-- Added CUDA NVCC flags for: -gencode;arch=compute_30,code=sm_30
CMake Warning at cmake/public/utils.cmake:169 (message):
  In the future we will require one to explicitly pass TORCH_CUDA_ARCH_LIST
  to cmake instead of implicitly setting it as an env variable.  This will
  become a FATAL_ERROR in future version of pytorch.
Call Stack (most recent call first):
  cmake/External/nccl.cmake:24 (torch_cuda_get_nvcc_gencode_flag)
  cmake/Dependencies.cmake:783 (include)
  CMakeLists.txt:201 (include)


-- Could NOT find CUB (missing: CUB_INCLUDE_DIR) 
-- CUDA detected: 10.1
-- 
-- ******** Summary ********
--   CMake version         : 3.14.0
--   CMake command         : /home/dominik/anaconda3/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 7.4.0
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -Wnon-virtual-dtor
--   Build type            : Release
--   Compile definitions   : TH_BLAS_MKL
--   CMAKE_PREFIX_PATH     : /home/dominik/anaconda3;/home/dominik/anaconda3/lib/python3.7/site-packages
--   CMAKE_INSTALL_PREFIX  : /home/dominik/Desktop/pytorch/torch/lib/tmp_install
--   CMAKE_MODULE_PATH     : /home/dominik/Desktop/pytorch/cmake/Modules;/home/dominik/Desktop/pytorch/cmake/public/../Modules_CUDA_fix
-- 
--   ONNX version          : 1.3.0
--   ONNX NAMESPACE        : onnx_torch
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
-- 
--   Protobuf compiler     : 
--   Protobuf includes     : 
--   Protobuf libraries    : 
--   BUILD_ONNX_PYTHON     : OFF
-- Found CUDA with FP16 support, compiling with torch.cuda.HalfTensor
-- Removing -DNDEBUG from compile flags
-- Compiling with OpenMP support
-- Compiling with MAGMA support
-- MAGMA INCLUDE DIRECTORIES: /home/dominik/anaconda3/include
-- MAGMA LIBRARIES: /home/dominik/anaconda3/lib/libmagma.a
-- MAGMA V2 check: 1
-- Could not find hardware support for NEON on this machine.
-- No OMAP3 processor on this machine.
-- No OMAP4 processor on this machine.
-- AVX compiler support found
-- AVX2 compiler support found
-- Atomics: using C11 intrinsics
-- Found a library with BLAS API (mkl).
-- Found a library with LAPACK API. (mkl)
disabling ROCM because NOT USE_ROCM is set
-- MIOpen not found. Compiling without MIOpen support
-- Found OpenMP_C: -fopenmp  
-- Found OpenMP_CXX: -fopenmp  
-- OpenMP lib: provided by compiler
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- VTune profiling environment is unset
-- Found MKL-DNN: TRUE
-- GCC 7.4.0: Adding gcc and gcc_s libs to link line
-- Using python found in /home/dominik/anaconda3/bin/python
-- Configuring build for SLEEF-v3.2
   Target system: Linux-4.18.0-25-generic
   Target processor: x86_64
   Host system: Linux-4.18.0-25-generic
   Host processor: x86_64
   Detected C compiler: GNU @ /usr/bin/cc
-- Using option `-Wall -Wno-unused -Wno-attributes -Wno-unused-result -Wno-psabi -ffp-contract=off -fno-math-errno -fno-trapping-math` to compile libsleef
-- Building shared libs : OFF
-- MPFR : /home/dominik/anaconda3/lib/libmpfr.so
-- MPFR header file in /home/dominik/anaconda3/include
-- GMP : /home/dominik/anaconda3/lib/libgmp.so
-- RUNNING_ON_TRAVIS : 0
-- COMPILER_SUPPORTS_OPENMP : 1
-- Using python found in /home/dominik/anaconda3/bin/python
-- /usr/bin/c++ /home/dominik/Desktop/pytorch/torch/abi-check.cpp -o /home/dominik/Desktop/pytorch/build/abi-check
-- Determined _GLIBCXX_USE_CXX11_ABI=1
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS) 
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS) 
-- Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND) 
-- Found CUDA: /usr/local/cuda (found suitable version "10.1", minimum required is "7.5") 
-- Building the gloo backend with TCP support only
-- Found CUDA: /usr/local/cuda (found version "10.1") 
-- Building C10D with CUDA support
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS) 
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS) 
-- Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND) 
-- Not able to find MPI, will compile c10d without MPI support
-- Include NCCL operators
-- Including IDEEP operators
-- Excluding image processing operators due to no opencv
-- Excluding video processing operators due to no opencv
-- MPI operators skipped due to no MPI support
-- Include Observer library
-- Using lib/python3.7/site-packages as python relative installation path
-- Automatically generating missing __init__.py files.
-- A previous caffe2 cmake run already created the __init__.py files.
CMake Warning at CMakeLists.txt:389 (message):
  Generated cmake files are only fully tested if one builds with system glog,
  gflags, and protobuf.  Other settings may generate files that are not well
  tested.


-- 
-- ******** Summary ********
-- General:
--   CMake version         : 3.14.0
--   CMake command         : /home/dominik/anaconda3/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 7.4.0
--   BLAS                  : MKL
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-stringop-overflow
--   Build type            : Release
--   Compile definitions   : TH_BLAS_MKL;ONNX_NAMESPACE=onnx_torch;MAGMA_V2;USE_C11_ATOMICS=1;HAVE_MMAP=1;_FILE_OFFSET_BITS=64;HAVE_SHM_OPEN=1;HAVE_SHM_UNLINK=1;HAVE_MALLOC_USABLE_SIZE=1
--   CMAKE_PREFIX_PATH     : /home/dominik/anaconda3;/home/dominik/anaconda3/lib/python3.7/site-packages
--   CMAKE_INSTALL_PREFIX  : /home/dominik/Desktop/pytorch/torch/lib/tmp_install
-- 
--   TORCH_VERSION         : 1.0.0
--   CAFFE2_VERSION        : 1.0.0
--   BUILD_ATEN_MOBILE     : OFF
--   BUILD_ATEN_ONLY       : OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : ON
--     Link local protobuf : ON
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : ON
--     Python version      : 3.7.3
--     Python executable   : /home/dominik/anaconda3/bin/python
--     Pythonlibs version  : 3.7.3
--     Python library      : /home/dominik/anaconda3/lib/libpython3.7m.so.1.0
--     Python includes     : /home/dominik/anaconda3/include/python3.7m
--     Python site-packages: lib/python3.7/site-packages
--   BUILD_CAFFE2_OPS      : ON
--   BUILD_SHARED_LIBS     : ON
--   BUILD_TEST            : ON
--   USE_ASAN              : OFF
--   USE_CUDA              : 1
--     CUDA static link    : 0
--     USE_CUDNN           : ON
--     CUDA version        : 10.1
--     cuDNN version       : 7.6.2
--     CUDA root directory : /usr/local/cuda
--     CUDA library        : /usr/lib/x86_64-linux-gnu/libcuda.so
--     cudart library      : /usr/local/cuda/lib64/libcudart.so
--     cublas library      : /usr/lib/x86_64-linux-gnu/libcublas.so
--     cufft library       : /usr/local/cuda/lib64/libcufft.so
--     curand library      : /usr/local/cuda/lib64/libcurand.so
--     cuDNN library       : /usr/lib/x86_64-linux-gnu/libcudnn.so.7
--     nvrtc               : /usr/local/cuda/lib64/libnvrtc.so
--     CUDA include path   : /usr/local/cuda/include
--     NVCC executable     : /usr/local/cuda/bin/nvcc
--     CUDA host compiler  : /usr/bin/cc
--     USE_TENSORRT        : OFF
--   USE_ROCM              : 0
--   USE_EIGEN_FOR_BLAS    : 
--   USE_FBGEMM            : 0
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : OFF
--   USE_GLOG              : OFF
--   USE_LEVELDB           : OFF
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : OFF
--   USE_METAL             : OFF
--   USE_MKL               : ON
--   USE_MKLDNN            : ON
--   USE_MOBILE_OPENGL     : OFF
--   USE_NCCL              : ON
--     USE_SYSTEM_NCCL     : OFF
--   USE_NNPACK            : 1
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : ON
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : OFF
--   USE_PROF              : OFF
--   USE_QNNPACK           : 1
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : ON
--     USE_MPI             : OFF
--     USE_GLOO            : ON
--     USE_GLOO_IBVERBS    : OFF
--   Public Dependencies  : Threads::Threads;caffe2::mkl;caffe2::mkldnn
--   Private Dependencies : qnnpack;nnpack;cpuinfo;fp16;gloo;aten_op_header_gen;onnxifi_loader;rt;gcc_s;gcc;dl
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dominik/Desktop/pytorch/build
+ make install -j4
[  1%] Built target js_embed
[  1%] Built target nccl_external
[  2%] Built target libprotobuf-lite
[  2%] Built target clog
[  2%] Built target pthreadpool
[  2%] Building CXX object third_party/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[  3%] Built target benchmark
[  4%] Built target gloo
[  8%] Built target libprotobuf
[  8%] Built target onnxifi_loader
[  8%] Built target onnxifi_dummy
[ 10%] Built target c10
[ 10%] Building CXX object third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/cpu/ref_rnn.cpp.o
[ 10%] Built target ATEN_CPU_FILES_GEN_TARGET
[ 10%] Built target common
[ 10%] Built target mkrename
[ 10%] Built target mkalias
[ 10%] Built target renameAVX512F.h_generated
[ 11%] Built target mkdisp
[ 11%] Building CXX object third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/cpu/simple_concat.cpp.o
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp: In instantiation of ‘void mkldnn::impl::cpu::_ref_rnn_common_t<aprop>::pack_weights(int, int, int, int, int, int, int, float**, int, int*, const float*, float*, bool) [with mkldnn_prop_kind_t aprop = (mkldnn_prop_kind_t)64]’:
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:1183:17:   required from here
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:891:53: error: ‘float* cblas_sgemm_alloc(CBLAS_IDENTIFIER, int, int, int)’ is deprecated [-Werror=deprecated-declarations]
                 weights(i, d, p) = cblas_sgemm_alloc(CblasAMatrix, m_p, n, k_p);
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:801:25: note: declared here
 MKL_DEPRECATED_C float* cblas_sgemm_alloc(const  CBLAS_IDENTIFIER identifier,
                         ^~~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:891:53: error: ‘float* cblas_sgemm_alloc(CBLAS_IDENTIFIER, int, int, int)’ is deprecated [-Werror=deprecated-declarations]
                 weights(i, d, p) = cblas_sgemm_alloc(CblasAMatrix, m_p, n, k_p);
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:801:25: note: declared here
 MKL_DEPRECATED_C float* cblas_sgemm_alloc(const  CBLAS_IDENTIFIER identifier,
                         ^~~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:891:53: error: ‘float* cblas_sgemm_alloc(CBLAS_IDENTIFIER, int, int, int)’ is deprecated [-Werror=deprecated-declarations]
                 weights(i, d, p) = cblas_sgemm_alloc(CblasAMatrix, m_p, n, k_p);
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:801:25: note: declared here
 MKL_DEPRECATED_C float* cblas_sgemm_alloc(const  CBLAS_IDENTIFIER identifier,
                         ^~~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp: In instantiation of ‘void mkldnn::impl::cpu::_ref_rnn_common_t<aprop>::free_packed_weights(int, int, int, float**) [with mkldnn_prop_kind_t aprop = (mkldnn_prop_kind_t)64]’:
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:1183:17:   required from here
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:979:33: error: ‘void cblas_sgemm_free(float*)’ is deprecated [-Werror=deprecated-declarations]
                 cblas_sgemm_free(weights(i, j, k));
                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:814:23: note: declared here
 MKL_DEPRECATED_C void cblas_sgemm_free(float *dest);
                       ^~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:979:33: error: ‘void cblas_sgemm_free(float*)’ is deprecated [-Werror=deprecated-declarations]
                 cblas_sgemm_free(weights(i, j, k));
                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:814:23: note: declared here
 MKL_DEPRECATED_C void cblas_sgemm_free(float *dest);
                       ^~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:979:33: error: ‘void cblas_sgemm_free(float*)’ is deprecated [-Werror=deprecated-declarations]
                 cblas_sgemm_free(weights(i, j, k));
                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:814:23: note: declared here
 MKL_DEPRECATED_C void cblas_sgemm_free(float *dest);
                       ^~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp: In instantiation of ‘void mkldnn::impl::cpu::_ref_rnn_common_t<aprop>::pack_weights(int, int, int, int, int, int, int, float**, int, int*, const float*, float*, bool) [with mkldnn_prop_kind_t aprop = (mkldnn_prop_kind_t)128]’:
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:1184:17:   required from here
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:891:53: error: ‘float* cblas_sgemm_alloc(CBLAS_IDENTIFIER, int, int, int)’ is deprecated [-Werror=deprecated-declarations]
                 weights(i, d, p) = cblas_sgemm_alloc(CblasAMatrix, m_p, n, k_p);
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:801:25: note: declared here
 MKL_DEPRECATED_C float* cblas_sgemm_alloc(const  CBLAS_IDENTIFIER identifier,
                         ^~~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:891:53: error: ‘float* cblas_sgemm_alloc(CBLAS_IDENTIFIER, int, int, int)’ is deprecated [-Werror=deprecated-declarations]
                 weights(i, d, p) = cblas_sgemm_alloc(CblasAMatrix, m_p, n, k_p);
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:801:25: note: declared here
 MKL_DEPRECATED_C float* cblas_sgemm_alloc(const  CBLAS_IDENTIFIER identifier,
                         ^~~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:891:53: error: ‘float* cblas_sgemm_alloc(CBLAS_IDENTIFIER, int, int, int)’ is deprecated [-Werror=deprecated-declarations]
                 weights(i, d, p) = cblas_sgemm_alloc(CblasAMatrix, m_p, n, k_p);
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:801:25: note: declared here
 MKL_DEPRECATED_C float* cblas_sgemm_alloc(const  CBLAS_IDENTIFIER identifier,
                         ^~~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp: In instantiation of ‘void mkldnn::impl::cpu::_ref_rnn_common_t<aprop>::free_packed_weights(int, int, int, float**) [with mkldnn_prop_kind_t aprop = (mkldnn_prop_kind_t)128]’:
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:1184:17:   required from here
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:979:33: error: ‘void cblas_sgemm_free(float*)’ is deprecated [-Werror=deprecated-declarations]
                 cblas_sgemm_free(weights(i, j, k));
                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:814:23: note: declared here
 MKL_DEPRECATED_C void cblas_sgemm_free(float *dest);
                       ^~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:979:33: error: ‘void cblas_sgemm_free(float*)’ is deprecated [-Werror=deprecated-declarations]
                 cblas_sgemm_free(weights(i, j, k));
                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:814:23: note: declared here
 MKL_DEPRECATED_C void cblas_sgemm_free(float *dest);
                       ^~~~~~~~~~~~~~~~
/home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:979:33: error: ‘void cblas_sgemm_free(float*)’ is deprecated [-Werror=deprecated-declarations]
                 cblas_sgemm_free(weights(i, j, k));
                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/gemm/os_blas.hpp:39:0,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.hpp:30,
                 from /home/dominik/Desktop/pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_rnn.cpp:39:
/home/dominik/anaconda3/include/mkl_cblas.h:814:23: note: declared here
 MKL_DEPRECATED_C void cblas_sgemm_free(float *dest);
                       ^~~~~~~~~~~~~~~~
[ 11%] Built target python_copy_files
[ 12%] Built target headers
[ 12%] Built target renamedsp128.h_generated
[ 12%] Built target renamedsp256.h_generated
[ 13%] Built target dispavx.c_generated
[ 13%] Built target renameSSE2.h_generated
[ 13%] Building CXX object third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/cpu/simple_sum.cpp.o
[ 13%] Built target renameFMA4.h_generated
[ 14%] Built target renameAVX2.h_generated
[ 14%] Built target renameSSE4.h_generated
[ 14%] Built target ATEN_CUDA_FILES_GEN_TARGET
[ 14%] Built target mkrename_gnuabi
[ 14%] Built target mkmasked_gnuabi
[ 14%] Built target arraymap
[ 14%] Built target torch_shm_manager
[ 14%] Built target c10_utils_hip
[ 14%] Built target c10_utils_cpu
[ 14%] Built target c10_utils_gpu
[ 14%] Building CXX object third_party/protobuf/cmake/CMakeFiles/libprotoc.dir/__/src/google/protobuf/compiler/js/js_generator.cc.o
cc1plus: all warnings being treated as errors
third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/build.make:1232: recipe for target 'third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/cpu/ref_rnn.cpp.o' failed
make[2]: *** [third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/cpu/ref_rnn.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 14%] Building CXX object third_party/protobuf/cmake/CMakeFiles/libprotoc.dir/__/src/google/protobuf/compiler/objectivec/objectivec_field.cc.o
CMakeFiles/Makefile2:1619: recipe for target 'third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/all' failed
make[1]: *** [third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Failed to run 'bash ../tools/build_pytorch_libs.sh --use-cuda --use-nnpack --use-mkldnn --use-qnnpack caffe2'

Try this: conda install numpy pyyaml mkl=2019.3 mkl-include setuptools cmake cffi typing and rebuild.

Hi,

Thanks for your answer.
I fixed it by using the mkl-dnn version v0.18.1. Now i can compile it from source.