apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.78k stars 6.79k forks source link

nnpack_fully_connected-inl.h:45:55: error: expected template-name before ‘<’ token > class NNPACKFullyConnectedOp : public FullyConnectedOp<xpu, DType> { > ^ #11868

Open StatML opened 6 years ago

StatML commented 6 years ago

Description

C++ Syntax Error occurs when building from source

Environment info (Required)

----------Python Info----------
Version      : 3.5.2
Compiler     : GCC 5.4.0 20160609
Build        : ('default', 'Nov 23 2017 16:37:01')
Arch         : ('64bit', 'ELF')
------------Pip Info-----------
Version      : 18.0
Directory    : /usr/local/lib/python3.5/dist-packages/pip
----------MXNet Info-----------
Version      : 1.3.0
Directory    : /usr/local/lib/python3.5/dist-packages/mxnet-1.3.0-py3.5.egg/mxnet
Hashtag not found. Not installed from pre-built package.
----------System Info----------
Platform     : Linux-4.13.0-32-generic-x86_64-with-Ubuntu-16.04-xenial
system       : Linux
node         : duan
release      : 4.13.0-32-generic
version      : #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018
----------Hardware Info----------
machine      : x86_64
processor    : x86_64
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                12
On-line CPU(s) list:   0-11
Thread(s) per core:    2
Core(s) per socket:    6
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 158
Model name:            Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Stepping:              10
CPU MHz:               3700.000
CPU max MHz:           4700.0000
CPU min MHz:           800.0000
BogoMIPS:              7392.00
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
NUMA node0 CPU(s):     0-11
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 smx 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 epb invpcid_single pti intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm 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 FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.3113 sec, LOAD: 2.2387 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.2170 sec, LOAD: 7.1835 sec.
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.2024 sec, LOAD: 5.8239 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.5033 sec, LOAD: 1.9694 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.3470 sec, LOAD: 3.6789 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.2580 sec, LOAD: 2.0935 sec.

Package used (Python/R/Scala/Julia): Python

Build info (Required if built from source)

In file included from src/operator/nn/fully_connected.cc:29:0: src/operator/nn/../nnpack/nnpack_fully_connected-inl.h:45:55: error: expected template-name before ‘<’ token class NNPACKFullyConnectedOp : public FullyConnectedOp<xpu, DType> { ^ src/operator/nn/../nnpack/nnpack_fully_connected-inl.h:45:55: error: expected ‘{’ before ‘<’ token src/operator/nn/../nnpack/nnpack_fully_connected-inl.h:45:55: error: expected unqualified-id before ‘<’ token Makefile:443: recipe for target 'build/src/operator/nn/fully_connected.o' failed make: [build/src/operator/nn/fully_connected.o] Error 1 make: Waiting for unfinished jobs....

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

MXNet commit hash: 74d669293f68cf7e9325dcedc569164f3d7cfa90

Build config:

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

# whether compile with options for MXNet developer
DEV = 0

# whether compile with debug
DEBUG = 0

# 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

# whether to enable CUDA runtime compilation
ENABLE_CUDA_RTC = 1

# whether use CuDNN R3 library
USE_CUDNN = 1

#whether to use NCCL library
USE_NCCL = 1
#add the path to NCCL library
USE_NCCL_PATH = /usr/local/lib/

# 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

# whether use MKL-DNN library
USE_MKLDNN = 0

# whether use NNPACK library
USE_NNPACK = 1

# 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 =

# 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_BLAS), mkl)
USE_STATIC_MKL = 1
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
    USE_F16C=0
else
    USE_SSE=1
endif

#----------------------------
# F16C instruction support for faster arithmetic of fp16 on CPU
#----------------------------
# For distributed training with fp16, this helps even if training on GPUs
# If left empty, checks CPU support and turns it on.
# For cross compilation, please check support for F16C on target device and turn off if necessary.
USE_F16C =

#----------------------------
# 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 = 0

#----------------------------
# 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
# git@github.com:dato-code/SFrame.git
# SFRAME_PATH = $(HOME)/SFrame
# MXNET_PLUGINS += plugin/sframe/plugin.mk

Error Message:

(Paste the complete error message, including stack trace.)

nnpack_fully_connected-inl.h:45:55: error: expected template-name before ‘<’ token

class NNPACKFullyConnectedOp : public FullyConnectedOp<xpu, DType> { ^

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 -j

What have you tried to solve it?

  1. -std=c++11
sandeep-krishnamurthy commented 6 years ago

@StatML - Thanks for submitting the issue. On which OS are you trying to build? Did you follow instructions for building MXNet from source here - http://mxnet.incubator.apache.org/install/index.html?platform=Linux&language=Python&processor=GPU

I tried on mac and ubuntu and it works.

Also, just to make sure you cloned recursively right?
git clone --recursive https://github.com/apache/incubator-mxnet

StatML commented 6 years ago

Hi @sandeep-krishnamurthy Thank you for your response. I am using Ubuntu 16.04 and I did follow the building instructions you pasted. :(

jaapkroe commented 6 years ago

I am seeing the same issue, is there any update or known fix for this ?

The build without NNPACK is fine, but with USE_NNPACK = 1 this error appears.

I followed the NNPACK installation guidelines from https://mxnet.incubator.apache.org/faq/nnpack.html

MartinRenaudin commented 5 years ago

I am seeing the same issue too!

I followed the NNPACK installation guidelines from https://mxnet.incubator.apache.org/faq/nnpack.html too! is there any update or known fix for this ?

StatML commented 5 years ago

I just tried on Ubuntu 18.04.1, this issue is still not fixed... :(

PapaMadeleine2022 commented 5 years ago

meet the same error

Linux distro and version:

LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core)
Release:    7.4.1708
Codename:   Core
pkuCactus commented 5 years ago

@MartinRenaudin do you have resolved this, i've met the same error, could you give some help? I found that in nnpack_fully_connected-inl.h the op inherit from fullyconnectedop but it cannot be recognized since it cannot find in fully_connected-inl.h. But i still have not method to resolve it.

fuhaizhou commented 4 years ago

got the same error here, still no solutions so far? this is the build script for MXNet 1.7 on docker:

# Install MAXNET
WORKDIR /
RUN git clone --recursive https://github.com/apache/incubator-mxnet mxnet && \
    cd mxnet && \
    git checkout tags/1.7.0 -b 1.7.0 && \
    git submodule update --init --recursive || true

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/NNPACK/lib

WORKDIR /mxnet
RUN cp make/staticbuild/linux_cpu.mk config.mk && \
    echo "ADD_LDFLAGS = -L/NNPACK/lib/ -lnnpack -lpthreadpool" >> config.mk && \
    echo "ADD_CFLAGS = -I/NNPACK/include/ -I/NNPACK/third-party/pthreadpool/include/ -I/opt/intel/mkl/include" >> config.mk  && \
    echo "USE_NNPACK=1" >> config.mk  && \
    echo "USE_BLAS=mkl" >> config.mk 
    # echo "USE_OPENCV=1" >> make/config.mk 

RUN make DMLCCORE
RUN make $PWD/3rdparty/tvm/nnvm/lib/libnnvm.a
RUN make PSLITE
RUN make mkldnn

WORKDIR /mxnet
# RUN rm -rf build && \
#     mkdir -p build && \
#     cd build && \
#     cmake -D USE_CUDA=OFF .. && \
#     cmake --build . --parallel ${nproc}
RUN make
Counterfeiter commented 3 years ago

Would like to build mxnet v1.6.x for raspberry pi 4 ubuntu (arm64), fails with the same error. Is NNPACK still supported? There are other unresolved issues with this package in the issue ticker...

Also cross compiling with docker fails... but I have to modify the build commands, to get it working until it fails at compile time...