Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#40592 closed defect (fixed)

openblas: fails to build with avx instructions

Reported by: cdeil (Christoph Deil) Owned by: NicosPavlov
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: NicosPavlov, todmorrison (Tod Morrison), bonoba@…
Port: openblas

Description

For Mac OS X 10.8 with XCode 5 and the gcc 4.7 openblas variant the build fails with errors such as

no such instruction: `vxorpd %xmm0, %xmm0,%xmm0'

Full log: https://gist.github.com/cdeil/6711021

Attachments (2)

Portfile_openblas.diff (405 bytes) - added by NicosPavlov 11 years ago.
Portfile_avx.diff (2.3 KB) - added by NicosPavlov 11 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 11 years ago by NicosPavlov

Owner: changed from macports-tickets@… to nicos@…
Status: newassigned

I changed the default compiler to gcc48 in between (which is the standard default on Macports now), but I don't think this is the issue.

It is probably some vectorization flag I don't get on my machine. With some googling, it seems that removing the -march=native flag could do the trick, as shown in the attached diff.

If that works, I would be grateful if you could confirm and perhaps attach your openblas_config.h file, as it seems to come from flags I can't test with my hardware.

Changed 11 years ago by NicosPavlov

Attachment: Portfile_openblas.diff added

comment:2 Changed 11 years ago by cdeil (Christoph Deil)

You're right ... I get the same issue with gcc48

I still get an error if I remove the -march=native flag: https://gist.github.com/cdeil/6715785

I couldn't find the the openblas_config.h file:

find /opt/local -name 'openblas_config.h'

If you want I can simply give you ssh access to this machine to debug ... it's a build test server for Python projects. OK?

comment:3 Changed 11 years ago by todmorrison (Tod Morrison)

Cc: todmorrison@… added

Cc Me!

comment:4 Changed 11 years ago by NicosPavlov

Right, after some search, the Apple assembler cannot handle AVX instructions, which is why it fails. Clang seems to be the only compiler able to deal with these instructions. The attached Portfile version should compile in all cases, by disabling avx for gcc compilers, but at the cost of performance, and adding a clang version which hopefully could compile avx instructions. I couldn't test it though, as my processor is too old to support these instructions, but it is partly based on the Atlas port, which works pretty well.

It is also still limited, as the Portfile uses a default fortran compiler without considering other usual variants.

Changed 11 years ago by NicosPavlov

Attachment: Portfile_avx.diff added

comment:5 Changed 11 years ago by NicosPavlov

Committed in r111803 with small improvements (use of XCode clang when possible, and detecting avx instruction to choose automatically the best variant). With these, the port should compile in any case, and should also detect the best variant to improve performance depending on the processor.

comment:6 Changed 11 years ago by bonoba@…

Cc: bonoba@… added

Cc Me!

comment:7 Changed 11 years ago by NicosPavlov

Resolution: fixed
Status: assignedclosed

Assuming the issue fixed with previous commit.

comment:8 Changed 11 years ago by cdeil (Christoph Deil)

For me the OpenBLAS build still fails with "no such instruction" errors: https://gist.github.com/cdeil/6949043/raw/a27720605d09382b8a4177ffe4941a1789b6050f/gistfile1.txt

comment:9 Changed 11 years ago by NicosPavlov

Resolution: fixed
Status: closedreopened
Summary: openblas: no such instruction install errorsopenblas: fails to build with avx instructions
Version: 2.2.0

Oh, ok. Thanks for the feedback. Thanks to your log though, it is possible to see that the library compiles now, which was not the case before, but the tests coded in fortran don't. I changed the fortran compiler in r112143, based (again) on tweaks in the atlas port. This should solve this last issue, but I reopen the ticket for now as it is not fully confirmed yet.

Version 0, edited 11 years ago by NicosPavlov (next)

comment:10 Changed 11 years ago by cdeil (Christoph Deil)

The OpenBLAS install now works, thanks!

Is there an easy way to run the unit OpenBLAS unit tests to check if everything works?

comment:11 Changed 11 years ago by NicosPavlov

Resolution: fixed
Status: reopenedclosed

The tests are run during the installation, so that a problem in the tests should result in a build error. It is possible to see them when installing the port with debug output.

sudo port -d install OpenBLAS

comment:12 Changed 10 years ago by petrrr

I just filed ticket #46684, which might be related. So I provide a point here ...

Note: See TracTickets for help on using tickets.