Incubator-mxnet: compiling from source failed

Created on 31 Dec 2017  Â·  4Comments  Â·  Source: apache/incubator-mxnet

Description

I try to compile the c++ api from the source code and met some error about cuda

Environment info (Required)

----------Python Info----------
Version      : 3.6.3
Compiler     : GCC 7.2.0
Build        : ('default', 'Oct 24 2017 14:48:20')
Arch         : ('64bit', '')
------------Pip Info-----------
Version      : 9.0.1
Directory    : /usr/lib/python3.6/site-packages/pip
----------MXNet Info-----------
No MXNet installed.
----------System Info----------
Platform     : Linux-4.13.12-1-ARCH-x86_64-with-arch
system       : Linux
node         : Arch-R720
release      : 4.13.12-1-ARCH
version      : #1 SMP PREEMPT Wed Nov 8 11:54:06 CET 2017
----------Hardware Info----------
machine      : x86_64
processor    : 
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               158
Model name:          Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
Stepping:            9
CPU MHz:             3208.493
CPU max MHz:         3500.0000
CPU min MHz:         800.0000
BogoMIPS:            4993.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            6144K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0247 sec, LOAD: 3.3866 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0097 sec, LOAD: 1.3392 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0586 sec, LOAD: 11.4271 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0092 sec, LOAD: 1.6135 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0200 sec, LOAD: 1.1366 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0750 sec, LOAD: 0.8653 sec.

Package used (Python/R/Scala/Julia):
(I'm using C++.)

Build info (Required if built from source)

Compiler (gcc/clang/mingw/visual studio): gcc

MXNet commit hash:
e4128ec76f919db46d5f401b411283cab0635e29

Build config:

#-------------------------------------------------------------------------------
#  Template configuration for compiling mxnet
#
#  If you want to change the configuration, please use the following
#  steps. Assume you are on the root directory of mxnet. First copy the this
#  file so that any local changes will be ignored by git
#
#  $ cp make/config.mk .
#
#  Next modify the according entries, and then compile by
#
#  $ make
#
#  or build in parallel with 8 threads
#
#  $ make -j8
#-------------------------------------------------------------------------------

#---------------------
# choice of compiler
#--------------------

export CC = gcc
export CXX = g++
export NVCC = nvcc

# whether compile with options for MXNet developer
DEV = 0

# whether compile with debug
DEBUG = 0

# whether compile with profiler
USE_PROFILER =

# whether to turn on segfault signal handler to log the stack trace
USE_SIGNAL_HANDLER =

# the additional link flags you want to add
ADD_LDFLAGS =

# the additional compile flags you want to add
ADD_CFLAGS =

#---------------------------------------------
# matrix computation libraries for CPU/GPU
#---------------------------------------------

# whether use CUDA during compile
USE_CUDA = 1

# add the path to CUDA library to link and compile flag
# if you have already add them to environment variable, leave it as NONE
# USE_CUDA_PATH = /usr/local/cuda
USE_CUDA_PATH = /opt/cuda

# whether use CuDNN R3 library
USE_CUDNN = 1

#whether to use NCCL library
USE_NCCL = 0
#add the path to NCCL library
USE_NCCL_PATH = NONE

# whether use opencv during compilation
# you can disable it, however, you will not able to use
# imbin iterator
USE_OPENCV = 1

#whether use libjpeg-turbo for image decode without OpenCV wrapper
USE_LIBJPEG_TURBO = 0
#add the path to libjpeg-turbo library
USE_LIBJPEG_TURBO_PATH = NONE

# use openmp for parallelization
USE_OPENMP = 1

# MKL ML Library for Intel CPU/Xeon Phi
# Please refer to MKL_README.md for details

# MKL ML Library folder, need to be root for /usr/local
# Change to User Home directory for standard user
# For USE_BLAS!=mkl only
MKLML_ROOT=/usr/local

# whether use MKL2017 library
USE_MKL2017 = 0

# whether use MKL2017 experimental feature for high performance
# Prerequisite USE_MKL2017=1
USE_MKL2017_EXPERIMENTAL = 0

# whether use NNPACK library
USE_NNPACK = 0

# choose the version of blas you want to use
# can be: mkl, blas, atlas, openblas
# in default use atlas for linux while apple for osx
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
USE_BLAS = apple
else
USE_BLAS = openblas
endif

# whether use lapack during compilation
# only effective when compiled with blas versions openblas/apple/atlas/mkl
USE_LAPACK = 1

# path to lapack library in case of a non-standard installation
USE_LAPACK_PATH =

# by default, disable lapack when using MKL
# switch on when there is a full installation of MKL available (not just MKL2017/MKL_ML)
ifeq ($(USE_BLAS), mkl)
USE_LAPACK = 0
endif

# add path to intel library, you may need it for MKL, if you did not add the path
# to environment variable
USE_INTEL_PATH = NONE

# If use MKL only for BLAS, choose static link automatically to allow python wrapper
ifeq ($(USE_MKL2017), 0)
ifeq ($(USE_BLAS), mkl)
USE_STATIC_MKL = 1
endif
else
USE_STATIC_MKL = NONE
endif

#----------------------------
# Settings for power and arm arch
#----------------------------
ARCH := $(shell uname -a)
ifneq (,$(filter $(ARCH), armv6l armv7l powerpc64le ppc64le aarch64))
    USE_SSE=0
else
    USE_SSE=1
endif

#----------------------------
# distributed computing
#----------------------------

# whether or not to enable multi-machine supporting
USE_DIST_KVSTORE = 0

# whether or not allow to read and write HDFS directly. If yes, then hadoop is
# required
USE_HDFS = 0

# path to libjvm.so. required if USE_HDFS=1
LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server

# whether or not allow to read and write AWS S3 directly. If yes, then
# libcurl4-openssl-dev is required, it can be installed on Ubuntu by
# sudo apt-get install -y libcurl4-openssl-dev
USE_S3 = 0

#----------------------------
# performance settings
#----------------------------
# Use operator tuning
USE_OPERATOR_TUNING = 1

# Use gperftools if found
USE_GPERFTOOLS = 1

# Use JEMalloc if found, and not using gperftools
USE_JEMALLOC = 1

#----------------------------
# additional operators
#----------------------------

# path to folders containing projects specific operators that you don't want to put in src/operators
EXTRA_OPERATORS =

#----------------------------
# other features
#----------------------------

# Create C++ interface package
USE_CPP_PACKAGE = 1

#----------------------------
# plugins
#----------------------------

# whether to use caffe integration. This requires installing caffe.
# You also need to add CAFFE_PATH/build/lib to your LD_LIBRARY_PATH
# CAFFE_PATH = $(HOME)/caffe
# MXNET_PLUGINS += plugin/caffe/caffe.mk

# WARPCTC_PATH = $(HOME)/warp-ctc
# MXNET_PLUGINS += plugin/warpctc/warpctc.mk

# whether to use sframe integration. This requires build sframe
# [email protected]:dato-code/SFrame.git
# SFRAME_PATH = $(HOME)/SFrame
# MXNET_PLUGINS += plugin/sframe/plugin.mk

Error Message:

Running 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_70,code=[sm_70,compute_70] --fatbin-options -compress-all
g++ -std=c++11 -c -DMSHADOW_FORCE_STREAM -Wall -Wsign-compare -O3 -DNDEBUG=1 -I/home/coin/build/incubator-mxnet/mshadow/ -I/home/coin/build/incubator-mxnet/dmlc-core/include -fPIC -I/home/coin/build/incubator-mxnet/nnvm/include -I/home/coin/build/incubator-mxnet/dlpack/include -Iinclude -funroll-loops -Wno-unused-variable -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-local-typedefs -msse3 -I/opt/cuda/include -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -DMSHADOW_RABIT_PS=0 -DMSHADOW_DIST_PS=0 -DMSHADOW_USE_PASCAL=0 -DMXNET_USE_OPENCV=1 -I/usr/include/opencv -fopenmp -DMXNET_USE_OPERATOR_TUNING=1 -DMXNET_USE_LAPACK -DMSHADOW_USE_CUDNN=1 -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free  -I/home/coin/build/incubator-mxnet/3rdparty/cub -DMXNET_USE_NCCL=0 -DMXNET_USE_LIBJPEG_TURBO=0 -MMD -c src/operator/nn/cudnn/cudnn_algoreg.cc -o build/src/operator/nn/cudnn/cudnn_algoreg.o
In file included from include/mxnet/./resource.h:31:0,
                 from include/mxnet/operator.h:39,
                 from src/operator/nn/cudnn/./../convolution-inl.h:33,
                 from src/operator/nn/cudnn/./cudnn_algoreg-inl.h:34,
                 from src/operator/nn/cudnn/cudnn_algoreg.cc:26:
include/mxnet/./../../src/common/random_generator.h: In static member function static void mxnet::common::random::RandGenerator<mshadow::gpu, DType>::AllocState(mxnet::common::random::RandGenerator<mshadow::gpu, DType>*)’:
include/mxnet/./../../src/common/random_generator.h:156:5: error: there are no arguments to ‘CUDA_CALL’ that depend on a template parameter, so a declaration of ‘CUDA_CALL’ must be available [-fpermissive]
     CUDA_CALL(cudaMalloc(&inst->states_,
     ^~~~~~~~~
include/mxnet/./../../src/common/random_generator.h:156:5: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
include/mxnet/./../../src/common/random_generator.h: In static member function static void mxnet::common::random::RandGenerator<mshadow::gpu, DType>::FreeState(mxnet::common::random::RandGenerator<mshadow::gpu, DType>*)’:
include/mxnet/./../../src/common/random_generator.h:161:5: error: there are no arguments to ‘CUDA_CALL’ that depend on a template parameter, so a declaration of ‘CUDA_CALL’ must be available [-fpermissive]
     CUDA_CALL(cudaFree(inst->states_));
     ^~~~~~~~~
make: *** [Makefile:373: build/src/operator/nn/cudnn/cudnn_algoreg.o] Error 1

Minimum reproducible example

(If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.)

Steps to reproduce

(Paste the commands you ran that produced the error.)

1. make clean
2. make

What have you tried to solve it?

1.
2.

Most helpful comment

I got similar error message.
And switching to gcc 6 solves my issue.
e.g. in config.mk

#---------------------
# choice of compiler
#--------------------

export CC = gcc-6
export CXX = g++-6
export NVCC = nvcc

All 4 comments

I got similar error message.
And switching to gcc 6 solves my issue.
e.g. in config.mk

#---------------------
# choice of compiler
#--------------------

export CC = gcc-6
export CXX = g++-6
export NVCC = nvcc

@iblis17 Ah, I see, Thanks a lot!!

@iblis17 works as expected, thanks!

In case you are using Mac OS, it is probably that you use GCC as the compiler. Change to clang in config.mk:

export CC = clang
export CXX = clang++
export NVCC = nvcc
Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonBoyleCoding picture JonBoyleCoding  Â·  3Comments

ranti-iitg picture ranti-iitg  Â·  3Comments

sbodenstein picture sbodenstein  Â·  3Comments

xzqjack picture xzqjack  Â·  3Comments

WangcsShuai picture WangcsShuai  Â·  3Comments