<p dir="auto">I have this error while building pytorch from source with gtx1060, cuda9.2, and cudnn7.1.4 on ubuntu 16.04</p>
<p dir="auto">-- Caffe2: Found protobuf with new-style protobuf targets.<br>
-- Caffe2: Protobuf version 3.5.0<br>
-- Caffe2: CUDA detected: 9.2<br>
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc<br>
-- Caffe2: CUDA toolkit directory: /usr/local/cuda<br>
-- Caffe2: Header version is: 9.2<br>
-- Found cuDNN: v7.1.4  (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/libcudnn.so.7)<br>
CMake Error at /home/dat/.py/pytorch/torch/lib/tmp_install/share/cmake/Caffe2/public/cuda.cmake:338 (cuda_select_nvcc_arch_flags):<br>
Unknown CMake command "cuda_select_nvcc_arch_flags".<br>
Call Stack (most recent call first):<br>
/home/dat/.py/pytorch/torch/lib/tmp_install/share/cmake/Caffe2/Caffe2Config.cmake:79 (include)<br>
CMakeLists.txt:7 (FIND_PACKAGE)</p>
<p dir="auto">-- Configuring incomplete, errors occurred!<br>
See also "/home/dat/.py/pytorch/torch/lib/build/libshm/CMakeFiles/CMakeOutput.log".<br>
See also "/home/dat/.py/pytorch/torch/lib/build/libshm/CMakeFiles/CMakeError.log".<br>
Failed to run 'bash tools/build_pytorch_libs.sh --with-cuda --with-nnpack nccl caffe2 nanopb libshm gloo THD'</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/pytorch/pytorch/blob/346568d40f301809591ae43fb4902c6ea93edce9/cmake/public/cuda.cmake#L343">pytorch/cmake/public/cuda.cmake</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 343
      in
      <a data-pjax="true" class="commit-tease-sha" href="/pytorch/pytorch/commit/346568d40f301809591ae43fb4902c6ea93edce9">346568d</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L343" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="343"></td>
          <td id="LC343" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> cuda_select_nvcc_arch_flags(NVCC_FLAGS_EXTRA <span class="pl-smi">${TORCH_CUDA_ARCH_LIST}</span>) </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
and neither requires cmake 3.9 nor adds Modules_CUDA_fix to cmake modules. This is breaking ubuntu 16.04 builds, and getting cmake 3.9 on ubuntu 16.04 is a pain.<br>
cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Yangqing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Yangqing">@Yangqing</a><p></p>