nvcc编译的程序似乎混淆了math.h和cmath.h命名空间

时间:2017-12-15 15:47:28

标签: c++ namespaces nvcc math.h cmath

我正在编译一个CUDA程序,它看起来很混乱(或者,我可能很困惑)关于cmath和math使用的命名空间。当我运行make时,我得到以下输出:

innovationcommons@IC-VR1:~/PackageDownloads/warp-ctc/build$ make VERBOSE=1
/usr/bin/cmake -H/home/innovationcommons/PackageDownloads/warp-ctc -B/home/innovationcommons/PackageDownloads/warp-ctc/build --check-build-system CMakeFiles/Makefile.cmake 0
Re-run cmake file: Makefile older than: CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend
-- cuda found TRUE
CMake Warning at CMakeLists.txt:48 (FIND_PACKAGE):
  By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Torch", but
  CMake did not find one.

  Could not find a package configuration file provided by "Torch" with any of
  the following names:

    TorchConfig.cmake
    torch-config.cmake

  Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
  "Torch_DIR" to a directory containing one of the above files.  If "Torch"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Torch found Torch_DIR-NOTFOUND
-- Building shared library with GPU support
-- Configuring done
-- Generating done
-- Build files have been written to: /home/innovationcommons/PackageDownloads/warp-ctc/build
/usr/bin/cmake -E cmake_progress_start /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
make -f CMakeFiles/warpctc.dir/build.make CMakeFiles/warpctc.dir/depend
make[2]: Entering directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
cd /home/innovationcommons/PackageDownloads/warp-ctc/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/innovationcommons/PackageDownloads/warp-ctc /home/innovationcommons/PackageDownloads/warp-ctc /home/innovationcommons/PackageDownloads/warp-ctc/build /home/innovationcommons/PackageDownloads/warp-ctc/build /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/warpctc.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
make -f CMakeFiles/warpctc.dir/build.make CMakeFiles/warpctc.dir/build
make[2]: Entering directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
make[2]: Nothing to be done for 'CMakeFiles/warpctc.dir/build'.
make[2]: Leaving directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
[ 42%] Built target warpctc
make -f CMakeFiles/test_cpu.dir/build.make CMakeFiles/test_cpu.dir/depend
make[2]: Entering directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
cd /home/innovationcommons/PackageDownloads/warp-ctc/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/innovationcommons/PackageDownloads/warp-ctc /home/innovationcommons/PackageDownloads/warp-ctc /home/innovationcommons/PackageDownloads/warp-ctc/build /home/innovationcommons/PackageDownloads/warp-ctc/build /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_cpu.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
make -f CMakeFiles/test_cpu.dir/build.make CMakeFiles/test_cpu.dir/build
make[2]: Entering directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
make[2]: Nothing to be done for 'CMakeFiles/test_cpu.dir/build'.
make[2]: Leaving directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
[ 71%] Built target test_cpu
make -f CMakeFiles/test_gpu.dir/build.make CMakeFiles/test_gpu.dir/depend
make[2]: Entering directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
[ 85%] Building NVCC (Device) object CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o
cd /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests && /usr/bin/cmake -E make_directory /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/.
cd /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests && /usr/bin/cmake -D verbose:BOOL=1 -D build_configuration:STRING= -D generated_file:STRING=/home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o -D generated_cubin_file:STRING=/home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o.cubin.txt -P /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.cmake
-- Removing /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o
/usr/bin/cmake -E remove /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o
-- Generating dependency file: /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.NVCC-depend
/usr/local/cuda-9.0/bin/nvcc -M -D__CUDACC__ /home/innovationcommons/PackageDownloads/warp-ctc/tests/test_gpu.cu -o /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.NVCC-depend -ccbin /usr/bin/cc -m64 -Xcompiler ,\"-fopenmp\",\"-O2\",\"-g\" -gencode arch=compute_30,code=sm_30 -O2 -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_62,code=sm_62 --std=c++11 -Xcompiler -fopenmp -DNVCC -I/usr/local/cuda-9.0/include -I/home/innovationcommons/PackageDownloads/warp-ctc/include
-- Generating temporary cmake readable file: /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend.tmp
/usr/bin/cmake -D input_file:FILEPATH=/home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.NVCC-depend -D output_file:FILEPATH=/home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend.tmp -D verbose=1 -P /usr/share/cmake-3.9/Modules/FindCUDA/make2cmake.cmake
-- Copy if different /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend.tmp to /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend
/usr/bin/cmake -E copy_if_different /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend.tmp /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend
-- Removing /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend.tmp and /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.NVCC-depend
/usr/bin/cmake -E remove /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.depend.tmp /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o.NVCC-depend
-- Generating /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o
/usr/local/cuda-9.0/bin/nvcc /home/innovationcommons/PackageDownloads/warp-ctc/tests/test_gpu.cu -c -o /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o -ccbin /usr/bin/cc -m64 -Xcompiler ,\"-fopenmp\",\"-O2\",\"-g\" -gencode arch=compute_30,code=sm_30 -O2 -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_62,code=sm_62 --std=c++11 -Xcompiler -fopenmp -DNVCC -I/usr/local/cuda-9.0/include -I/home/innovationcommons/PackageDownloads/warp-ctc/include
/home/innovationcommons/PackageDownloads/warp-ctc/tests/test_gpu.cu(301): error: namespace "std" has no member "isinf"

/home/innovationcommons/PackageDownloads/warp-ctc/tests/test_gpu.cu(311): error: namespace "std" has no member "isnan"

2 errors detected in the compilation of "/tmp/tmpxft_00000be9_00000000-12_test_gpu.compute_62.cpp1.ii".
-- Removing /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o
/usr/bin/cmake -E remove /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o
CMake Error at test_gpu_generated_test_gpu.cu.o.cmake:282 (message):
  Error generating file
  /home/innovationcommons/PackageDownloads/warp-ctc/build/CMakeFiles/test_gpu.dir/tests/./test_gpu_generated_test_gpu.cu.o


CMakeFiles/test_gpu.dir/build.make:438: recipe for target 'CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o' failed
make[2]: *** [CMakeFiles/test_gpu.dir/tests/test_gpu_generated_test_gpu.cu.o] Error 1
make[2]: Leaving directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/test_gpu.dir/all' failed
make[1]: *** [CMakeFiles/test_gpu.dir/all] Error 2
make[1]: Leaving directory '/home/innovationcommons/PackageDownloads/warp-ctc/build'
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

我得到的错误是isinfisnan不属于std命名空间。我的理解是,如果导入math.h,则情况属实,但如果导入cmath.h则不行。但是,我可以在上一个编译行中看到std=c++11,当我检查test_gpu.cu时,我看到正在导入cmath

#include <cmath>
#include <random>
#include <tuple>
#include <vector>
#include <iostream>

此时,我真的不知道如何继续。任何想法或建议都会有所帮助......

ADDENDUM:这是值得的,这是我的编译器信息:

innovationcommons@IC-VR1:~/PackageDownloads/warp-ctc/build$ gcc --version
gcc (Ubuntu 4.8.5-4ubuntu6) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

innovationcommons@IC-VR1:~/PackageDownloads/warp-ctc/build$ g++ --version
g++ (Ubuntu 4.8.5-4ubuntu6) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

附录2:有关我的设置以及我尝试安装的更多信息:

Ubuntu 17.10
gcc: 4.8.5
g++: 4.8.5
CUDA Version: 9.0
nvcc version: 9.0.176
glibc version: 2.26

我正在尝试从https://github.com/baidu-research/warp-ctc

安装warp-ctc

0 个答案:

没有答案