8000 Only set '-O2' as opt flags on is_not_win by tomspur · Pull Request #6473 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Only set '-O2' as opt flags on is_not_win #6473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

tomspur
Copy link
@tomspur tomspur commented Oct 14, 2015

The current flags include '-march=x86-64', which causes build failures if e.g.
scipy is built on ARM. It would be better to rely on the default CFLAGS of the
linux distributions instead of adding more flags other than '-O2'.

Would something like the attached patch possible to not set any flags other than '-O2' on linux?
Or should the else part be a is_win64 instead?

@charris
Copy link
Member
charris commented Oct 15, 2015

Hmm, the implementation doesn't appeal to me, but there does look to be a problem that needs a solution. Could you be more specific as to the systems you are building on? @juliantaylor, @rgommers Suggestions?

@tomspur
Copy link
Author
tomspur commented Oct 15, 2015

Yeah, it just serves at a initial implementation for discussions...

I use the Fedora build system and the failing built is here. The full error on ARM is:

running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
customize Gnu95FCompiler using build_clib
building 'dfftpack' library
compiling Fortran sources
Fortran f77 compiler: /usr/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O2 -march=x86-64 -DMS_WIN64 -mtune=generic -msse2
Fortran f90 compiler: /usr/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O2 -march=x86-64 -DMS_WIN64 -mtune=generic -msse2
Fortran fix compiler: /usr/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -fPIC -O2 -march=x86-64 -DMS_WIN64 -mtune=generic -msse2
creating build/temp.linux-armv7l-3.4
creating build/temp.linux-armv7l-3.4/scipy
creating build/temp.linux-armv7l-3.4/scipy/fftpack
creating build/temp.linux-armv7l-3.4/scipy/fftpack/src
creating build/temp.linux-armv7l-3.4/scipy/fftpack/src/dfftpack
compile options: '-I/usr/lib/python3.4/site-packages/numpy/core/include -c'
gfortran:f77: scipy/fftpack/src/dfftpack/dcosqb.f
gfortran: error: unrecognized argument in option '-march=x86-64'
gfortran: note: valid arguments to '-march=' are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc iwmmxt iwmmxt2 native
gfortran: error: unrecognized argument in option '-mtune=generic'
gfortran: note: valid arguments to '-mtune=' are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m3 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale
gfortran: error: unrecognized command line option '-msse2'
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'test_suite'
  warnings.warn(msg)
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'setup_requires'
  warnings.warn(msg)
/usr/lib/python3.4/site-packages/numpy/distutils/system_info.py:635: UserWarning: Specified path  is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
Running from scipy source directory.
/usr/lib/python3.4/site-packages/numpy/distutils/system_info.py:635: UserWarning: Specified path /usr/local/include/python3.4m is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
/usr/lib/python3.4/site-packages/numpy/distutils/system_info.py:635: UserWarning: Specified path /usr/include/suitesparse/python3.4m is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])
"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])
"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])
"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])
"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])
"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])
gfortran: error: unrecognized argument in option '-march=x86-64'
gfortran: note: valid arguments to '-march=' are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc iwmmxt iwmmxt2 native
gfortran: error: unrecognized argument in option '-mtune=generic'
gfortran: note: valid arguments to '-mtune=' are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m3 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale
gfortran: error: unrecognized command line option '-msse2'
error: Command "/usr/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O2 -march=x86-64 -DMS_WIN64 -mtune=generic -msse2 -I/usr/lib/python3.4/site-packages/numpy/core/include -c -c scipy/fftpack/src/dfftpack/dcosqb.f -o build/temp.linux-armv7l-3.4/scipy/fftpack/src/dfftpack/dcosqb.o" failed with exit status 1
error: Bad exit status from /var/tmp/rpm-tmp.AhD1Sr (%build)
    Bad exit status from /var/tmp/rpm-tmp.AhD1Sr (%build)

@charris charris added this to the 1.10.2 release milestone Oct 15, 2015
@charris
Copy link
Member
charris commented Oct 19, 2015

You are building on ARM, not cross compiling, is that correct? What does sys.platform show?

@tomspur tomspur force-pushed the remove_opt_flags_linux branch from 6b81de1 to 38b4604 Compare October 19, 2015 16:21
The current flags include '-march=x86-64', which causes build failures if e.g.
scipy is built on ARM. It would be better to rely on the default CFLAGS of the
linux distributions instead of adding more flags other than '-O2'.
@tomspur tomspur force-pushed the remove_opt_flags_linux branch from 38b4604 to 329d9b2 Compare October 19, 2015 16:27
@tomspur
Copy link
Author
tomspur commented Oct 19, 2015

Yes, the builds are running on ARM. sys.platform on python2 says linux2 and on python3 linux. I guess that the updated patch is a bit more appealing - yet untested on the Fedora build system.

@charris
Copy link
Member
charris commented Oct 19, 2015

What about

In [1]: import platform

In [2]: platform.machine()
Out[2]: 'x86_64'

@tomspur
Copy link
Author
tomspur commented Oct 19, 2015

platform.uname should include various properties from platform (I just removed the address of the node):
uname_result(system='Linux', node='removed', release='4.1.8-100.fc21.armv7hl', version='#1 SMP Tue Sep 22 13:35:56 UTC 2015', machine='armv7l', processor='armv7l')

@charris
Copy link
Member
charris commented Oct 19, 2015

OK, the whole thing was a mess. Back in 1.9 it was

    def get_flags_opt(self):
        v = self.get_version()
        if v and v<='3.3.3':
            # With this compiler version building Fortran BLAS/LAPACK
            # with -O3 caused failures in lib.lapack heevr,syevr tests.
            opt = ['-O2']
        else:
            opt = ['-O3']
        opt.append('-funroll-loops')
        return opt

The changes that you are fixing seem due to the work @carlkl is doing for windows. See also #6495. I think this is also broken in 1.10.x.

@charris
Copy link
Member
charris commented Oct 20, 2015

I've reverted the mingwpy changes in the 1.10.x branch. Can you give it a try?

@homu
Copy link
Contributor
homu commented Oct 21, 2015

☔ The latest upstream changes (presumably #6534) made this pull request unmergeable. Please resolve the merge conflicts.

@charris
Copy link
Member
charris commented Oct 21, 2015

I've reverted the mingwpy changes in master also. Can you say if there is still a problem?

@charris
Copy link
Member
charris commented Oct 22, 2015

Closing this. Please reopen if the problem persists with the current numpy.

@charris charris closed this Oct 22, 2015
@charris charris removed this from the 1.10.2 release milestone Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0