Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#21797 closed defect (fixed)

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

Reported by: todmorrison (Tod Morrison) Owned by: stechert@…
Priority: Normal Milestone:
Component: ports Version: 1.8.1
Keywords: BLAS Accelerate Cc: luis.beca@…, tenomoto (Takeshi Enomoto), michaelld (Michael Dickens)
Port: octave

Description (last modified by mf2k (Frank Schima))

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 (2)

dotwrp.f90 (796 bytes) - added by tenomoto (Takeshi Enomoto) 14 years ago.
Portfile.diff (1.1 KB) - added by tenomoto (Takeshi Enomoto) 14 years ago.
a patch to enable link agains Accelerate.framework (rev 3 added --with-blas="-framework Accelerate")

Download all attachments as: .zip

Change History (25)

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

Cc: luis.beca@… added

Cc Me!

comment:2 Changed 15 years ago by mf2k (Frank Schima)

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

comment:3 Changed 15 years ago by alakazam@…

Status: newassigned

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 15 years ago by alakazam@…

Switching to having atlas as a dependency fixes this issue.

comment:5 Changed 15 years ago by alakazam@…

Resolution: fixed
Status: assignedclosed

Fixed in r61160.

comment:6 Changed 15 years ago by todmorrison (Tod Morrison)

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 15 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: closedreopened

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 15 years ago by tenomoto (Takeshi Enomoto)

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

comment:9 Changed 15 years ago by tenomoto (Takeshi Enomoto)

Cc: takeshi@… added

Cc Me!

comment:10 Changed 15 years ago by jjstickel@…

Cc: jjstickel@… added

Cc Me!

comment:11 Changed 15 years ago by alakazam@…

Owner: alakazam@… deleted
Status: reopenednew

comment:12 Changed 14 years ago by jmroot (Joshua Root)

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

comment:13 Changed 14 years ago by jjstickel@…

Cc: jjstickel@… removed

Cc Me!

comment:14 Changed 14 years ago by todmorrison (Tod Morrison)

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

comment:15 Changed 14 years ago by todmorrison (Tod Morrison)

Cc: todmorrison@… added

Cc Me!

comment:16 Changed 14 years ago by todmorrison (Tod Morrison)

Cc: todmorrison@… removed

Cc Me!

Changed 14 years ago by tenomoto (Takeshi Enomoto)

Attachment: dotwrp.f90 added

comment:17 Changed 14 years ago by tenomoto (Takeshi Enomoto)

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 14 years ago by tenomoto (Takeshi Enomoto)

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

comment:19 Changed 14 years ago by tenomoto (Takeshi Enomoto)

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 14 years ago by michaelld (Michael Dickens)

Cc: michaelld@… added

Cc Me!

comment:21 Changed 14 years ago by tenomoto (Takeshi Enomoto)

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 14 years ago by tenomoto (Takeshi Enomoto)

Attachment: Portfile.diff added

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

comment:22 Changed 14 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

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 14 years ago by tenomoto (Takeshi Enomoto)

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.