编译Caffe时遇adadelta_solver相关NVCC错误,求排查方案
Hey there, let's break down this NVCC error you're facing—it's a common gotcha when setting up Caffe, and I've worked through similar issues a few times. Here are the most likely causes and fixes to get your compilation back on track:
Mismatched CUDA and Caffe Versions
Older versions of Caffe (like the official 1.0 release) don't play nice with newer CUDA versions (10.0+). The NVCC command-line syntax changed in newer CUDA releases, which can trigger this "single input file required" error.
Fix: Either downgrade CUDA to a compatible version (CUDA 8.0 or 9.0 are recommended for Caffe 1.0) or apply community patches to update Caffe for newer CUDA support.Broken CUDA_ARCH Configuration in Makefile.config
This is the most frequent culprit. If yourCUDA_ARCHsettings have syntax errors—like missing commas, misplaced spaces, or incomplete-gencodelines—NVCC gets confused and interprets parts of the config as input files.
Fix: Double-check yourMakefile.configto ensure theCUDA_ARCHsection follows this correct format:CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \ -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_61,code=compute_61Make sure each line ends with a backslash (
\) to continue the list, and there are no typos in the arch codes.Corrupted Makefile Rules
If you manually edited the mainMakefile, you might have accidentally broken the rule that generates NVCC commands for.cufiles. This can lead to NVCC being passed multiple input files when it expects just one.
Fix: Start fresh by copying the example config:cp Makefile.config.example Makefile.config, reconfigure your settings (like enabling CUDA, setting paths), then runmake clean && make all -j$(nproc)to rebuild from scratch.Damaged Source File or Permissions
Rarely, theadadelta_solver.cufile might be corrupted, or your user account might lack read permissions for it.
Fix: Verify the file exists and is readable withls -l src/caffe/solvers/adadelta_solver.cu. If it looks off, re-clone the Caffe repository to get fresh source files.
Give these steps a try—start with checking the CUDA_ARCH config first, since that's the easiest fix and the most common cause.
内容的提问来源于stack exchange,提问作者安世杰

