New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #21797 (closed defect: fixed)

Opened 5 years ago

Last modified 3 years ago

octave-3.2.2 needs FFLAGs='-ff2c' to use system BLAS (-framework Accelerate) with gcc43/gcc44

Reported by: todmorrison@… Owned by: stechert@…
Priority: Normal Milestone:
Component: ports Version: 1.8.1
Keywords: BLAS Accelerate Cc: luis.beca@…, takeshi@…, michaelld@…
Port: octave

Description (last modified by macsforever2000@…) (diff)

Without the FFLAG '-ff2c' with gcc43 and gcc44 a check for whether certain BLAS routines are called correctly during configure will fail and as a result the build will use the reference BLAS rather than the optimized BLAS available in the Accelerate framework. Adding,

  configure.fflags='-ff2c'

corrects this problem and allows Octave to compile against the optimized library.

Attachments

dotwrp.f90 (796 bytes) - added by takeshi@… 4 years ago.
Portfile.diff (1.1 KB) - added by takeshi@… 3 years ago.
a patch to enable link agains Accelerate.framework (rev 3 added --with-blas="-framework Accelerate")

Change History

comment:1 Changed 5 years ago by luis.beca@…

  • Cc luis.beca@… added

Cc Me!

comment:2 Changed 5 years ago by macsforever2000@…

  • Cc stechert@… added
  • Owner changed from macports-tickets@… to alakazam@…
  • Description modified (diff)
  • Keywords Octave removed
  • Port changed from Octave-3.2.2 to octave

comment:3 Changed 4 years ago by alakazam@…

  • Status changed from new to assigned

I have just added

configure.fflags    -ff2c

to the Portfile. The configure phase seems to show that this option is used, but doesn't fix the issue :

(...)
configure: defining FFLAGS to be -ff2c -m64 -mieee-fp
(...)
configure: WARNING: A BLAS library was detected but found incompatible with your Fortran 77 compiler.  The reference BLAS implementation will be used. To improve performance, consider using a different Fortran
 compiler or a switch like -ff2c to make your Fortran compiler use a calling convention compatible with the way your BLAS library was compiled, or use a different BLAS library.
(...)

comment:4 Changed 4 years ago by alakazam@…

Switching to having atlas as a dependency fixes this issue.

comment:5 Changed 4 years ago by alakazam@…

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed in r61160.

comment:6 Changed 4 years ago by todmorrison@…

Deleting the dependency on Atlas and adding configure.fflags="-ff2c" works for me and enables proper linking with vecLib. Linking to atlas is an inferior option, since one of the advantages of OSX is it's vendor optimized Blas/Lapack libraries.

comment:7 Changed 4 years ago by takeshi@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

Sorry to write to a closed ticket. I prefer Accelerate.framework because of 1) performance and 2) lack of +g95 in atlas. However, gfortran fails with sdot with -ff2c and with cdotu and zdotu without -ff2c. With trial and error I found that octave is configured to use Accelerate.framework with -fdefault-real-8 and explicit specification of type (real*4 for sdot and complex*8 for cdotu). I would think this problem pertains to x86_64 and ppc64 only but I have not tested. G95 does not have this problem. I will attach a patch.

comment:8 Changed 4 years ago by takeshi@…

Forgot to mention that arpack requires Accelerate. That is why -framework Accelerated is added to LIBS.

comment:9 Changed 4 years ago by takeshi@…

  • Cc takeshi@… added

Cc Me!

comment:10 Changed 4 years ago by jjstickel@…

  • Cc jjstickel@… added

Cc Me!

comment:11 Changed 4 years ago by alakazam@…

  • Status changed from reopened to new
  • Owner alakazam@… deleted

comment:12 Changed 4 years ago by jmr@…

  • Owner set to stechert@…
  • Cc stechert@… removed

comment:13 Changed 4 years ago by jjstickel@…

  • Cc jjstickel@… removed

Cc Me!

comment:14 Changed 4 years ago by todmorrison@…

I believe the portfile patch to add a no_atlas variant in Ticket #22997 resolves this problem as well.

comment:15 Changed 4 years ago by todmorrison@…

  • Cc todmorrison@… added

Cc Me!

comment:16 Changed 4 years ago by todmorrison@…

  • Cc todmorrison@… removed

Cc Me!

Changed 4 years ago by takeshi@…

comment:17 Changed 4 years ago by takeshi@…

I updated the patch and addressed the *dot* problem (solution).

In order to build atlas free octave:

  1. Install SuiteSparse with +accelerate (or simply +g95 if you prefer g95 to gfortran).
  2. Use the patch #25186 and install arpack with +accelerate (or simply +g95 if you prefer g95 to gfortran).
  3. Use the patch here to install octave ith +accelerate (or simply +g95 if you prefer g95 to gfortran). With g95 put dotwrp.f90 into files.

comment:18 Changed 4 years ago by takeshi@…

Oops +accelerate of qrupdate has been renamed. use +no_atlas.

comment:19 Changed 4 years ago by takeshi@…

Corrections to the procedure to build atlas free octave and formatting.

  • SuiteSparse does not have accelerate or g95 options. I confused it with arpack.
  1. Use the patch #25186 and install arpack with +no_atlas (or simply +g95 if you prefer g95 to gfortran).
  2. Use the patch here to install octave with +no_atlas (or simply +g95 if you prefer g95 to gfortran). With g95 put dotwrp.f90 into files.

comment:20 Changed 4 years ago by michaelld@…

  • Cc michaelld@… added

Cc Me!

comment:21 Changed 3 years ago by takeshi@…

I updated the patch. The previous one builds fine but mkoctfile had a bad reference to dotwrp.o in a temporary file and did not function. I made dotwrp a separate port. I am testing the same with octave-devel but I have a problem with liboctinterp.dylib. It has a reference to a function which does not exist in none of libstdc++ installed on my machine. With the stable octave-3.2.4 the patch works fine for me.

Changed 3 years ago by takeshi@…

a patch to enable link agains Accelerate.framework (rev 3 added --with-blas="-framework Accelerate")

comment:22 Changed 3 years ago by jmr@…

  • Status changed from new to closed
  • Resolution set to fixed

Committed a variation on this patch in r74740. Unfortunately there is a bug with 64-bit SDOT in 10.6's Accelerate.framework, so the new variant can't be used there.

comment:23 Changed 3 years ago by takeshi@…

Great news! Thank you for the update.

I look at the MacResearch webpage. I was able to run that test successfully without -ff2c and with dotwrp.

$ gfortran-mp-4.5 -fno-underscoring dotwrp.f90 -c
$ ar cru libdotwrp.a dotwrp.o
$ gfortran-mp-4.5 my_conftest.f -L. -ldotwrp -framework Accelerate
$ ./a.out   1.0000000       2.0000000       2.0000000       2.0000000    
 (  1.0000000    ,  1.0000000    ) (  1.0000000    ,  2.0000000    ) ( -1.0000000    ,  3.0000000    ) ( -1.0000000    ,  3.0000000    )

I added gcc44 and gcc45 variants to dotwrp (r74749). The same approach as g95 might work as well for gcc44 and gcc45.

Note: See TracTickets for help on using tickets.