问题
The Raspberry Pi ( armv7l architecture ) has neon vfpv4 support which can be used for optimization.
Does the standard version of numpy include these optimizations when installing the command pip3 install numpy
or apt-get python3-numpy
?
I am not talking about blas and lapack. Native numpy.
回答1:
As Mark Setchell noted, numpy
does not appear to have specific code that targets NEON intrinsics. However, that is not the full story. Modern compilers are frequently able to take serially written code and transform it to use SIMD intrinsics. For instance, GCC can partially unroll loops and use NEON's SIMD instructions to perform multiple iterations of the loop at the same time.
The next thing to note is that pip install
and apt-get install
will do different things. apt-get
will fetch a prebuilt binary from the Raspbian/Debian repository (depending which you are using). Whereas pip
can only fetch the source of numpy
when on ARM architectures. This is because the Python Package Index (PyPI) does not store binaries for ARM architectures.
Debian and Raspbian both appear to have armhf
versions of python3-numpy
in their repositories. The hf
stands for "hard float" -- floating point computations done in hardware as opposed to software. This debian page also appears to suggest that armhf
packages have been compiled to take advantage of NEON intrinsics, but results have been limited. That is, GCC is using the NEON intrinsics, but isn't as finely tuned (yet) as it is when using SSE/SSE2 intrinsics.
pip
would be the worse option in this case as it appears that GCC is a bit cautious when it comes to targeting ARM floating point instructions. That is, pip will download the numpy source and compile it on your Raspberry Pi, but might not optimise the code as much as it can by default. You will probably need to tell pip to use a few compiler options by using the --global-option
argument. eg --global-option="-mfloat-abi=hard"
. You can find a comprehensive set of options to pass here.
回答2:
Chiming in on my recent experience trying to compile numpy and scipy on an Nvidia TX2 to use ARM optimizations. This is a bit different than the original poster's question, in that I'm using a newer ARM architecture, and the compiler flags appropriate for armhf that Dunes references are not all relevant. The TX2 has 4 ARM cortex a57's plus two "Denver" cores (custom ARM cores designed by Nvidia).
This page has the AArch64 compiler options: https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
I found the best way to build numpy and scipy with specific compiler optimizations was to create a site.cfg
file in the project root directory. There is a site.cfg.example
in the repo (both in scipy and numpy). In the [All] section, I set extra_compile_args =
line to include those ARM compiler directives of choice. From my experience, I was unable to use the --global-option
argument of Pip, per Dunes' suggestion, to pass through these flags when building Numpy.
That said, I tried a few different variations of these compiler flags, such as -mtune=cortex-a57
and was unable to beat the performance as compared to the python3-numpy
and python3-scipy
packages available via apt-get. So your mileage may vary.
回答3:
Updated Answer - January 2019
I used readelf
to look at what I believe is the main Numpy shared object library on my Raspberry Pi as follows:
cd /usr/lib/python3/dist-packages/numpy/core
readelf -a -W multiarray.cpython-35m-arm-linux-gnueabihf.so
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0xe068
Start of program headers: 52 (bytes into file)
Start of section headers: 1283864 (bytes into file)
Flags: 0x5000400, Version5 EABI, hard-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 28
Section header string table index: 27
...
...
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "6"
Tag_CPU_arch: v6
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_FP_arch: VFPv2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
I noted that none of the following are present, so I still think Numpy doesn't use NEON SIMD on Raspberry Pi. I am very happy to be told I am wrong if anyone knows better!!!! Please do.
Tag_FP_arch: VFPv3
Tag_Advanced_SIMD_arch: NEONv1
Updated Answer - November 2018
You can check the way Numpy was compiled as below:
import pprint
import numpy.distutils
config_vars = numpy.distutils.unixccompiler.sysconfig.get_config_vars()
pprint.pprint(config_vars)
And I get this - still no mention of NEON:
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy.distutils
>>> np_config_vars = numpy.distutils.unixccompiler.sysconfig.get_config_vars()
>>> import pprint
>>> pprint.pprint(np_config_vars)
{'AC_APPLE_UNIVERSAL_BUILD': 0,
'AIX_GENUINE_CPLUSPLUS': 0,
'AR': 'arm-linux-gnueabihf-gcc-ar',
'ARFLAGS': 'rc',
'ASDLGEN': '../Parser/asdl_c.py',
'ASDLGEN_FILES': '../Parser/asdl.py ../Parser/asdl_c.py',
'AST_ASDL': '../Parser/Python.asdl',
'AST_C': 'Python/Python-ast.c',
'AST_C_DIR': 'Python',
'AST_H': 'Include/Python-ast.h',
'AST_H_DIR': 'Include',
'ATHEOS_THREADS': 0,
'BASECFLAGS': '-fno-strict-aliasing',
'BASEMODLIBS': '',
'BEOS_THREADS': 0,
'BINDIR': '/usr/bin',
'BINLIBDEST': '/usr/lib/python2.7',
'BLDLIBRARY': '-L. -lpython2.7',
'BLDSHARED': 'arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security ',
'BUILDEXE': '',
'BUILDPYTHON': 'python',
'CC': 'arm-linux-gnueabihf-gcc -pthread',
'CCSHARED': '-fPIC',
'CFLAGS': '-fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security ',
'CFLAGSFORSHARED': '-fPIC',
'CONFIGFILES': 'configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in',
'CONFIGURE_CFLAGS': '-Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security',
'CONFIGURE_CPPFLAGS': '',
'CONFIGURE_LDFLAGS': '-Wl,-z,relro',
'CONFIG_ARGS': "'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-unicode=ucs4' '--with-dbmliborder=bdb:gdbm' '--with-system-expat' '--with-computed-gotos' '--with-system-ffi' '--with-fpectl' 'CC=arm-linux-gnueabihf-gcc' 'CFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-z,relro'",
'CONFINCLUDEDIR': '/usr/include',
'CONFINCLUDEPY': '/usr/include/python2.7',
'COREPYTHONPATH': ':plat-arm-linux-gnueabihf:lib-tk:lib-old',
'COVERAGE_INFO': '/build/python2.7-9xgeTe/python2.7-2.7.13/build-shared/coverage.info',
'COVERAGE_REPORT': '/build/python2.7-9xgeTe/python2.7-2.7.13/build-shared/lcov-report',
'COVERAGE_REPORT_OPTIONS': '--no-branch-coverage --title "CPython lcov report"',
'CPPFLAGS': '-I. -IInclude -I../Include',
'CXX': 'arm-linux-gnueabihf-g++ -pthread',
'C_THREADS': 0,
'DEBUG_EXT': '',
'DESTDIRS': '/usr /usr/lib /usr/lib/python2.7 /usr/lib/python2.7/lib-dynload',
'DESTLIB': '/usr/lib/python2.7',
'DESTPATH': '',
'DESTSHARED': '/usr/lib/python2.7/lib-dynload',
'DIRMODE': 755,
'DIST': 'README ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Demo Ext-dummy',
'DISTDIRS': 'Include Lib Misc Demo Ext-dummy',
'DISTFILES': 'README ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in',
'DLINCLDIR': '.',
'DLLLIBRARY': '',
'DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754': 0,
'DOUBLE_IS_BIG_ENDIAN_IEEE754': 0,
'DOUBLE_IS_LITTLE_ENDIAN_IEEE754': 1,
'DYNLOADFILE': 'dynload_shlib.o',
'ENABLE_IPV6': 1,
'ENSUREPIP': 'no',
'EXE': '',
'EXEMODE': 755,
'EXTRAMACHDEPPATH': '',
'EXTRAPLATDIR': '',
'EXTRATESTOPTS': '',
'FILEMODE': 644,
'FLOCK_NEEDS_LIBBSD': 0,
'GETPGRP_HAVE_ARG': 0,
'GETTIMEOFDAY_NO_TZ': 0,
'GLHACK': '-Dclear=__GLclear',
'GNULD': 'yes',
'GRAMMAR_C': 'Python/graminit.c',
'GRAMMAR_H': 'Include/graminit.h',
'GRAMMAR_INPUT': '../Grammar/Grammar',
'HAVE_ACOSH': 1,
'HAVE_ADDRINFO': 1,
'HAVE_ALARM': 1,
'HAVE_ALLOCA_H': 1,
'HAVE_ALTZONE': 0,
'HAVE_ASINH': 1,
'HAVE_ASM_TYPES_H': 1,
'HAVE_ATANH': 1,
'HAVE_ATTRIBUTE_FORMAT_PARSETUPLE': 0,
'HAVE_BIND_TEXTDOMAIN_CODESET': 1,
'HAVE_BLUETOOTH_BLUETOOTH_H': 1,
'HAVE_BLUETOOTH_H': 0,
'HAVE_BROKEN_NICE': 0,
'HAVE_BROKEN_PIPE_BUF': 0,
'HAVE_BROKEN_POLL': 0,
'HAVE_BROKEN_POSIX_SEMAPHORES': 0,
'HAVE_BROKEN_PTHREAD_SIGMASK': 0,
'HAVE_BROKEN_SEM_GETVALUE': 0,
'HAVE_BROKEN_UNSETENV': 0,
'HAVE_C99_BOOL': 1,
'HAVE_CHFLAGS': 0,
'HAVE_CHOWN': 1,
'HAVE_CHROOT': 1,
'HAVE_CLOCK': 1,
'HAVE_COMPUTED_GOTOS': 1,
'HAVE_CONFSTR': 1,
'HAVE_CONIO_H': 0,
'HAVE_COPYSIGN': 1,
'HAVE_CTERMID': 1,
'HAVE_CTERMID_R': 0,
'HAVE_CURSES_H': 1,
'HAVE_CURSES_IS_TERM_RESIZED': 1,
'HAVE_CURSES_RESIZETERM': 1,
'HAVE_CURSES_RESIZE_TERM': 1,
'HAVE_DECL_ISFINITE': 1,
'HAVE_DECL_ISINF': 1,
'HAVE_DECL_ISNAN': 1,
'HAVE_DECL_TZNAME': 0,
'HAVE_DEVICE_MACROS': 1,
'HAVE_DEV_PTC': 0,
'HAVE_DEV_PTMX': 1,
'HAVE_DIRECT_H': 0,
'HAVE_DIRENT_H': 1,
'HAVE_DLFCN_H': 1,
'HAVE_DLOPEN': 1,
'HAVE_DUP2': 1,
'HAVE_DYNAMIC_LOADING': 1,
'HAVE_EPOLL': 1,
'HAVE_ERF': 1,
'HAVE_ERFC': 1,
'HAVE_ERRNO_H': 1,
'HAVE_EXECV': 1,
'HAVE_EXPM1': 1,
'HAVE_FCHDIR': 1,
'HAVE_FCHMOD': 1,
'HAVE_FCHOWN': 1,
'HAVE_FCNTL_H': 1,
'HAVE_FDATASYNC': 1,
'HAVE_FINITE': 1,
'HAVE_FLOCK': 1,
'HAVE_FORK': 1,
'HAVE_FORKPTY': 1,
'HAVE_FPATHCONF': 1,
'HAVE_FSEEK64': 0,
'HAVE_FSEEKO': 1,
'HAVE_FSTATVFS': 1,
'HAVE_FSYNC': 1,
'HAVE_FTELL64': 0,
'HAVE_FTELLO': 1,
'HAVE_FTIME': 1,
'HAVE_FTRUNCATE': 1,
'HAVE_GAI_STRERROR': 1,
'HAVE_GAMMA': 1,
'HAVE_GCC_ASM_FOR_X87': 0,
'HAVE_GETADDRINFO': 1,
'HAVE_GETCWD': 1,
'HAVE_GETC_UNLOCKED': 1,
'HAVE_GETENTROPY': 0,
'HAVE_GETGROUPS': 1,
'HAVE_GETHOSTBYNAME': 0,
'HAVE_GETHOSTBYNAME_R': 1,
'HAVE_GETHOSTBYNAME_R_3_ARG': 0,
'HAVE_GETHOSTBYNAME_R_5_ARG': 0,
'HAVE_GETHOSTBYNAME_R_6_ARG': 1,
'HAVE_GETITIMER': 1,
'HAVE_GETLOADAVG': 1,
'HAVE_GETLOGIN': 1,
'HAVE_GETNAMEINFO': 1,
'HAVE_GETPAGESIZE': 1,
'HAVE_GETPEERNAME': 1,
'HAVE_GETPGID': 1,
'HAVE_GETPGRP': 1,
'HAVE_GETPID': 1,
'HAVE_GETPRIORITY': 1,
'HAVE_GETPWENT': 1,
'HAVE_GETRESGID': 1,
'HAVE_GETRESUID': 1,
'HAVE_GETSID': 1,
'HAVE_GETSPENT': 1,
'HAVE_GETSPNAM': 1,
'HAVE_GETTIMEOFDAY': 1,
'HAVE_GETWD': 1,
'HAVE_GRP_H': 1,
'HAVE_HSTRERROR': 1,
'HAVE_HYPOT': 1,
'HAVE_IEEEFP_H': 0,
'HAVE_INET_ATON': 1,
'HAVE_INET_PTON': 1,
'HAVE_INITGROUPS': 1,
'HAVE_INT32_T': 1,
'HAVE_INT64_T': 1,
'HAVE_INTTYPES_H': 1,
'HAVE_IO_H': 0,
'HAVE_KILL': 1,
'HAVE_KILLPG': 1,
'HAVE_KQUEUE': 0,
'HAVE_LANGINFO_H': 1,
'HAVE_LARGEFILE_SUPPORT': 1,
'HAVE_LCHFLAGS': 0,
'HAVE_LCHMOD': 0,
'HAVE_LCHOWN': 1,
'HAVE_LGAMMA': 1,
'HAVE_LIBDL': 1,
'HAVE_LIBDLD': 0,
'HAVE_LIBIEEE': 0,
'HAVE_LIBINTL_H': 1,
'HAVE_LIBREADLINE': 1,
'HAVE_LIBRESOLV': 0,
'HAVE_LIBUTIL_H': 0,
'HAVE_LINK': 1,
'HAVE_LINUX_NETLINK_H': 1,
'HAVE_LINUX_TIPC_H': 1,
'HAVE_LOG1P': 1,
'HAVE_LONG_DOUBLE': 1,
'HAVE_LONG_LONG': 1,
'HAVE_LSTAT': 1,
'HAVE_MAKEDEV': 1,
'HAVE_MEMMOVE': 1,
'HAVE_MEMORY_H': 1,
'HAVE_MKFIFO': 1,
'HAVE_MKNOD': 1,
'HAVE_MKTIME': 1,
'HAVE_MMAP': 1,
'HAVE_MREMAP': 1,
'HAVE_NCURSES_H': 1,
'HAVE_NDIR_H': 0,
'HAVE_NETPACKET_PACKET_H': 1,
'HAVE_NICE': 1,
'HAVE_OPENPTY': 1,
'HAVE_OSX105_SDK': 0,
'HAVE_PATHCONF': 1,
'HAVE_PAUSE': 1,
'HAVE_PLOCK': 0,
'HAVE_POLL': 1,
'HAVE_POLL_H': 1,
'HAVE_PROCESS_H': 0,
'HAVE_PROTOTYPES': 1,
'HAVE_PTH': 0,
'HAVE_PTHREAD_ATFORK': 1,
'HAVE_PTHREAD_DESTRUCTOR': 0,
'HAVE_PTHREAD_H': 1,
'HAVE_PTHREAD_INIT': 0,
'HAVE_PTHREAD_SIGMASK': 1,
'HAVE_PTY_H': 1,
'HAVE_PUTENV': 1,
'HAVE_READLINK': 1,
'HAVE_REALPATH': 1,
'HAVE_RL_CALLBACK': 1,
'HAVE_RL_CATCH_SIGNAL': 1,
'HAVE_RL_COMPLETION_APPEND_CHARACTER': 1,
'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK': 1,
'HAVE_RL_COMPLETION_MATCHES': 1,
'HAVE_RL_COMPLETION_SUPPRESS_APPEND': 1,
'HAVE_RL_PRE_INPUT_HOOK': 1,
'HAVE_RL_RESIZE_TERMINAL': 1,
'HAVE_ROUND': 1,
'HAVE_SELECT': 1,
'HAVE_SEM_GETVALUE': 1,
'HAVE_SEM_OPEN': 1,
'HAVE_SEM_TIMEDWAIT': 1,
'HAVE_SEM_UNLINK': 1,
'HAVE_SETEGID': 1,
'HAVE_SETEUID': 1,
'HAVE_SETGID': 1,
'HAVE_SETGROUPS': 1,
'HAVE_SETITIMER': 1,
'HAVE_SETLOCALE': 1,
'HAVE_SETPGID': 1,
'HAVE_SETPGRP': 1,
'HAVE_SETREGID': 1,
'HAVE_SETRESGID': 1,
'HAVE_SETRESUID': 1,
'HAVE_SETREUID': 1,
'HAVE_SETSID': 1,
'HAVE_SETUID': 1,
'HAVE_SETVBUF': 1,
'HAVE_SHADOW_H': 1,
'HAVE_SIGACTION': 1,
'HAVE_SIGINTERRUPT': 1,
'HAVE_SIGNAL_H': 1,
'HAVE_SIGRELSE': 1,
'HAVE_SNPRINTF': 1,
'HAVE_SOCKADDR_SA_LEN': 0,
'HAVE_SOCKADDR_STORAGE': 1,
'HAVE_SOCKETPAIR': 1,
'HAVE_SPAWN_H': 1,
'HAVE_SSIZE_T': 1,
'HAVE_STATVFS': 1,
'HAVE_STAT_TV_NSEC': 1,
'HAVE_STAT_TV_NSEC2': 0,
'HAVE_STDARG_PROTOTYPES': 1,
'HAVE_STDINT_H': 1,
'HAVE_STDLIB_H': 1,
'HAVE_STRDUP': 1,
'HAVE_STRFTIME': 1,
'HAVE_STRINGS_H': 1,
'HAVE_STRING_H': 1,
'HAVE_STROPTS_H': 1,
'HAVE_STRUCT_STAT_ST_BIRTHTIME': 0,
'HAVE_STRUCT_STAT_ST_BLKSIZE': 1,
'HAVE_STRUCT_STAT_ST_BLOCKS': 1,
'HAVE_STRUCT_STAT_ST_FLAGS': 0,
'HAVE_STRUCT_STAT_ST_GEN': 0,
'HAVE_STRUCT_STAT_ST_RDEV': 1,
'HAVE_STRUCT_TM_TM_ZONE': 1,
'HAVE_SYMLINK': 1,
'HAVE_SYSCONF': 1,
'HAVE_SYSEXITS_H': 1,
'HAVE_SYS_AUDIOIO_H': 0,
'HAVE_SYS_BSDTTY_H': 0,
'HAVE_SYS_DIR_H': 0,
'HAVE_SYS_EPOLL_H': 1,
'HAVE_SYS_EVENT_H': 0,
'HAVE_SYS_FILE_H': 1,
'HAVE_SYS_LOADAVG_H': 0,
'HAVE_SYS_LOCK_H': 0,
'HAVE_SYS_MKDEV_H': 0,
'HAVE_SYS_MODEM_H': 0,
'HAVE_SYS_NDIR_H': 0,
'HAVE_SYS_PARAM_H': 1,
'HAVE_SYS_POLL_H': 1,
'HAVE_SYS_RESOURCE_H': 1,
'HAVE_SYS_SELECT_H': 1,
'HAVE_SYS_SOCKET_H': 1,
'HAVE_SYS_STATVFS_H': 1,
'HAVE_SYS_STAT_H': 1,
'HAVE_SYS_TERMIO_H': 0,
'HAVE_SYS_TIMES_H': 1,
'HAVE_SYS_TIME_H': 1,
'HAVE_SYS_TYPES_H': 1,
'HAVE_SYS_UN_H': 1,
'HAVE_SYS_UTSNAME_H': 1,
'HAVE_SYS_WAIT_H': 1,
'HAVE_TCGETPGRP': 1,
'HAVE_TCSETPGRP': 1,
'HAVE_TEMPNAM': 1,
'HAVE_TERMIOS_H': 1,
'HAVE_TERM_H': 1,
'HAVE_TGAMMA': 1,
'HAVE_THREAD_H': 0,
'HAVE_TIMEGM': 1,
'HAVE_TIMES': 1,
'HAVE_TMPFILE': 1,
'HAVE_TMPNAM': 1,
'HAVE_TMPNAM_R': 1,
'HAVE_TM_ZONE': 1,
'HAVE_TRUNCATE': 1,
'HAVE_TZNAME': 0,
'HAVE_UCS4_TCL': 0,
'HAVE_UINT32_T': 1,
'HAVE_UINT64_T': 1,
'HAVE_UINTPTR_T': 1,
'HAVE_UNAME': 1,
'HAVE_UNISTD_H': 1,
'HAVE_UNSETENV': 1,
'HAVE_USABLE_WCHAR_T': 1,
'HAVE_UTIL_H': 0,
'HAVE_UTIMES': 1,
'HAVE_UTIME_H': 1,
'HAVE_WAIT3': 1,
'HAVE_WAIT4': 1,
'HAVE_WAITPID': 1,
'HAVE_WCHAR_H': 1,
'HAVE_WCSCOLL': 1,
'HAVE_WORKING_TZSET': 1,
'HAVE_ZLIB_COPY': 1,
'HAVE__GETPTY': 0,
'HGBRANCH': '',
'HGTAG': '',
'HGVERSION': '',
'HOST_GNU_TYPE': 'armv7l-unknown-linux-gnueabihf',
'HURD_C_THREADS': 0,
'INCLDIRSTOMAKE': '/usr/include /usr/include /usr/include/python2.7 /usr/include/python2.7',
'INCLUDEDIR': '/usr/include',
'INCLUDEPY': '/usr/include/python2.7',
'INSTALL': '/usr/bin/install -c',
'INSTALL_DATA': '/usr/bin/install -c -m 644',
'INSTALL_PROGRAM': '/usr/bin/install -c',
'INSTALL_SCRIPT': '/usr/bin/install -c',
'INSTALL_SHARED': '/usr/bin/install -c -m 555',
'INSTSONAME': 'libpython2.7.so.1.0',
'LDCXXSHARED': 'arm-linux-gnueabihf-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions',
'LDFLAGS': '-Wl,-z,relro',
'LDLAST': '',
'LDLIBRARY': 'libpython2.7.so',
'LDLIBRARYDIR': '',
'LDSHARED': 'arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security ',
'LIBC': '',
'LIBDEST': '/usr/lib/python2.7',
'LIBDIR': '/usr/lib',
'LIBFFI_INCLUDEDIR': '',
'LIBM': '-lm',
'LIBOBJDIR': 'Python/',
'LIBOBJS': '',
'LIBP': '/usr/lib/python2.7',
'LIBPC': '/usr/lib/arm-linux-gnueabihf/pkgconfig',
'LIBPL': '/usr/lib/python2.7/config-arm-linux-gnueabihf',
'LIBRARY': 'libpython2.7.a',
'LIBRARY_OBJS': '\\',
'LIBS': '-lpthread -ldl -lutil',
'LIBSUBDIRS': 'lib-tk lib-tk/test lib-tk/test/test_tkinter \\',
'LINKCC': 'arm-linux-gnueabihf-gcc -pthread',
'LINKFORSHARED': '-Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions',
'LLVM_PROF_ERR': 'no',
'LLVM_PROF_FILE': '',
'LLVM_PROF_MERGER': 'true',
'LN': 'ln',
'LOCALMODLIBS': '-L/usr/lib -lz',
'MACHDEP': 'linux2',
'MACHDEPPATH': ':plat-arm-linux-gnueabihf',
'MACHDEPS': 'plat-arm-linux-gnueabihf',
'MACHDEP_OBJS': '',
'MACHDESTLIB': '/usr/lib/python2.7',
'MACH_C_THREADS': 0,
'MACOSX_DEPLOYMENT_TARGET': '',
'MAINCC': 'arm-linux-gnueabihf-gcc -pthread',
'MAJOR_IN_MKDEV': 0,
'MAJOR_IN_SYSMACROS': 0,
'MAKESETUP': '../Modules/makesetup',
'MANDIR': '/usr/share/man',
'MEMTESTOPTS': '-l -x test_subprocess test_io test_lib2to3 \\ -x test_dl test___all__ test_fork1 \\',
'MKDIR_P': '/bin/mkdir -p',
'MODLIBS': '-L/usr/lib -lz',
'MODOBJS': 'Modules/threadmodule.o Modules/signalmodule.o Modules/arraymodule.o Modules/cmathmodule.o Modules/mathmodule.o Modules/_math.o Modules/_struct.o Modules/timemodule.o Modules/operator.o Modules/_randommodule.o Modules/_collectionsmodule.o Modules/_heapqmodule.o Modules/itertoolsmodule.o Modules/stropmodule.o Modules/_functoolsmodule.o Modules/datetimemodule.o Modules/_bisectmodule.o Modules/unicodedata.o Modules/_localemodule.o Modules/bufferedio.o Modules/bytesio.o Modules/fileio.o Modules/iobase.o Modules/_iomodule.o Modules/stringio.o Modules/textio.o Modules/fcntlmodule.o Modules/spwdmodule.o Modules/grpmodule.o Modules/selectmodule.o Modules/socketmodule.o Modules/timemodule.o Modules/md5module.o Modules/md5.o Modules/shamodule.o Modules/sha256module.o Modules/sha512module.o Modules/syslogmodule.o Modules/binascii.o Modules/cStringIO.o Modules/cPickle.o Modules/zlibmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/zipimport.o Modules/symtablemodule.o Modules/xxsubtype.o',
'MODULE_OBJS': '\\',
'MULTIARCH': 'arm-linux-gnueabihf',
'MVWDELCH_IS_EXPRESSION': 1,
'OBJECT_OBJS': '\\',
'OLDPATH': ':lib-old',
'OPCODETARGETGEN': '\\',
'OPCODETARGETGEN_FILES': '\\',
'OPCODETARGETS_H': '\\',
'OPT': '-DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes',
'OTHER_LIBTOOL_OPT': '',
'PACKAGE_BUGREPORT': 0,
'PACKAGE_NAME': 0,
'PACKAGE_STRING': 0,
'PACKAGE_TARNAME': 0,
'PACKAGE_URL': 0,
'PACKAGE_VERSION': 0,
'PARSER_HEADERS': '\\',
'PARSER_OBJS': '\\ Parser/myreadline.o Parser/tokenizer.o',
'PGEN': 'Parser/pgen',
'PGENOBJS': '\\ \\',
'PGENSRCS': '\\ \\',
'PGOBJS': '\\',
'PGO_PROF_GEN_FLAG': '-fprofile-generate',
'PGO_PROF_USE_FLAG': '',
'PGSRCS': '\\',
'PLATDIR': 'plat-arm-linux-gnueabihf',
'PLATMACDIRS': 'plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \\',
'PLATMACPATH': ':plat-mac:plat-mac/lib-scriptpackages',
'POBJS': '\\',
'POSIX_SEMAPHORES_NOT_ENABLED': 0,
'PROFILE_TASK': '-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess',
'PSRCS': '\\',
'PTHREAD_SYSTEM_SCHED_SUPPORTED': 1,
'PURIFY': '',
'PYLONG_BITS_IN_DIGIT': 0,
'PYTHON': 'python',
'PYTHONFRAMEWORK': '',
'PYTHONFRAMEWORKDIR': 'no-framework',
'PYTHONFRAMEWORKINSTALLDIR': '',
'PYTHONFRAMEWORKPREFIX': '',
'PYTHONPATH': ':plat-arm-linux-gnueabihf:lib-tk:lib-old',
'PYTHON_FOR_BUILD': './python -E',
'PYTHON_HEADERS': '\\',
'PYTHON_OBJS': '\\',
'PY_CFLAGS': '-fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security ',
'PY_CORE_CFLAGS': '-fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -I. -IInclude -I../Include -fPIC -DPy_BUILD_CORE',
'PY_CPPFLAGS': '-I. -IInclude -I../Include',
'PY_FORMAT_LONG_LONG': '"ll"',
'PY_FORMAT_SIZE_T': '"z"',
'PY_LDFLAGS': '-Wl,-z,relro',
'PY_UNICODE_TYPE': 'wchar_t',
'Py_DEBUG': 0,
'Py_ENABLE_SHARED': 1,
'Py_UNICODE_SIZE': 4,
'Py_USING_UNICODE': 1,
'QUICKTESTOPTS': '-l -x test_subprocess test_io test_lib2to3 \\',
'RANLIB': 'arm-linux-gnueabihf-gcc-ranlib',
'RESSRCDIR': 'Mac/Resources/framework',
'RETSIGTYPE': 'void',
'RUNSHARED': 'LD_LIBRARY_PATH=/build/python2.7-9xgeTe/python2.7-2.7.13/build-shared',
'SCRIPTDIR': '/usr/lib',
'SETPGRP_HAVE_ARG': 0,
'SGI_ABI': '',
'SHELL': '/bin/sh',
'SHLIBS': '-lpthread -ldl -lutil',
'SHLIB_EXT': '".so"',
'SIGNAL_OBJS': '',
'SIGNED_RIGHT_SHIFT_ZERO_FILLS': 0,
'SITEPATH': '',
'SIZEOF_DOUBLE': 8,
'SIZEOF_FLOAT': 4,
'SIZEOF_FPOS_T': 16,
'SIZEOF_INT': 4,
'SIZEOF_LONG': 4,
'SIZEOF_LONG_DOUBLE': 8,
'SIZEOF_LONG_LONG': 8,
'SIZEOF_OFF_T': 8,
'SIZEOF_PID_T': 4,
'SIZEOF_PTHREAD_T': 4,
'SIZEOF_SHORT': 2,
'SIZEOF_SIZE_T': 4,
'SIZEOF_TIME_T': 4,
'SIZEOF_UINTPTR_T': 4,
'SIZEOF_VOID_P': 4,
'SIZEOF_WCHAR_T': 4,
'SIZEOF__BOOL': 1,
'SO': '.so',
'SRCDIRS': 'Parser Grammar Objects Python Modules Mac',
'SRC_GDB_HOOKS': '../Tools/gdb/libpython.py',
'STDC_HEADERS': 1,
'STRICT_SYSV_CURSES': "/* Don't use ncurses extensions */",
'STRINGLIB_HEADERS': '\\',
'SUBDIRS': '',
'SUBDIRSTOO': 'Include Lib Misc Demo',
'SVNVERSION': 'echo Unversioned directory',
'SYSLIBS': '-lm',
'SYS_SELECT_WITH_SYS_TIME': 1,
'TANH_PRESERVES_ZERO_SIGN': 1,
'TCLTK_INCLUDES': '',
'TCLTK_LIBS': '',
'TESTOPTS': '-l',
'TESTPATH': '',
'TESTPROG': '../Lib/test/regrtest.py',
'TESTPYTHON': 'LD_LIBRARY_PATH=/build/python2.7-9xgeTe/python2.7-2.7.13/build-shared ./python -Wd -3 -E -tt',
'TESTPYTHONOPTS': '',
'THREADOBJ': 'Python/thread.o',
'TIME_WITH_SYS_TIME': 1,
'TKPATH': ':lib-tk',
'TM_IN_SYS_TIME': 0,
'UNICODE_OBJS': 'Objects/unicodeobject.o Objects/unicodectype.o',
'UNIVERSALSDK': '',
'USE_COMPUTED_GOTOS': 1,
'USE_TOOLBOX_OBJECT_GLUE': 0,
'VA_LIST_IS_ARRAY': 0,
'VERSION': '2.7',
'VPATH': '..',
'WANT_SIGFPE_HANDLER': 1,
'WANT_WCTYPE_FUNCTIONS': 0,
'WINDOW_HAS_FLAGS': 1,
'WITH_DOC_STRINGS': 1,
'WITH_DYLD': 0,
'WITH_LIBINTL': 0,
'WITH_NEXT_FRAMEWORK': 0,
'WITH_PYMALLOC': 1,
'WITH_THREAD': 1,
'WITH_TSC': 0,
'WITH_VALGRIND': 0,
'X87_DOUBLE_ROUNDING': 0,
'XMLLIBSUBDIRS': 'xml xml/dom xml/etree xml/parsers xml/sax',
'abs_builddir': '/build/python2.7-9xgeTe/python2.7-2.7.13/build-shared',
'abs_srcdir': '/build/python2.7-9xgeTe/python2.7-2.7.13/build-shared/..',
'build': 'armv7l-unknown-linux-gnueabihf',
'datarootdir': '/usr/share',
'exec_prefix': '/usr',
'host': 'armv7l-unknown-linux-gnueabihf',
'prefix': '/usr',
'srcdir': '..'}
Original Answer
I downloaded the numpy
source from Github and searched all the files for anything related to NEON, Raspberry Pi, VFPV3/4 and found nothing at all:
find . -type f -exec grep -Ei "neon|vfpv|rasp" {} +
./branding/icons/numpylogoicon.svg:BdKSolPgKfvIDPs6QVBky6rDZ0tZyoXr6VFPV93bY8uBGX82cde4ykqhH6ULoF2veusIosa1reLm
./doc/neps/nep-0021-advanced-indexing.rst:Since the various kinds of indexing is hard to grasp in many cases, these
./doc/neps/nep-0021-advanced-indexing.rst:These examples may be hard to grasp without working knowledge of advanced
./doc/source/reference/c-api.rst:grasp. This is especially true because of the code-generation
./numpy/core/src/umath/simd.inc.src: * In future it may contain other instruction sets like AVX or NEON detected
I'm no expert on numpy
but I'll stick my neck out and say there is no support for NEON in the current numpy
version.
来源:https://stackoverflow.com/questions/52161063/is-numpy-optimized-for-raspberry-pi-automatically