Opened 14 years ago

Closed 14 years ago

#24923 closed enhancement (fixed)

RFE: Allow atlas to build universal

Reported by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) Owned by: jameskyle@…
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: atlas universal Cc: SlaunchaMan (Jeff Kelley)
Port: atlas

Description

Adding (32/64-bit) universal support has been discussed on the mailing list:
http://lists.macosforge.org/pipermail/macports-dev/2010-March/thread.html#11407

There is also a proposed change:
http://lists.macosforge.org/pipermail/macports-dev/2010-May/011870.html

Attached is another proposed change.
It uses the muniversal PortGroup to actually merge the architectures.
As far as I can tell, it does not require any changes to gcc (such as --enable-multilib).

Attachments (1)

Portfile.diff (12.3 KB) - added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) 14 years ago.

Download all attachments as: .zip

Change History (15)

Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Attachment: Portfile.diff added

comment:1 Changed 14 years ago by Veence (Vincent)

If I understand your portfile correctly, universal conflicts with the use of any gcc-mp compilers. At the same time, how do you compile universal Fortran sources?

comment:2 in reply to:  1 Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to vince@…:

If I understand your portfile correctly, universal conflicts with the use of any gcc-mp compilers. At the same time, how do you compile universal Fortran sources?

If neither the gcc42 nor the gcc43 variant is selected, then gcc 4.4 is used.
The relevant code is

if { [variant_isset gcc42] } { 
    set gccversion    4.2 
 } elseif { [variant_isset gcc43] } { 
    set gccversion    4.3
} else {
    set gccversion    4.4
} 

comment:3 Changed 14 years ago by Veence (Vincent)

Then your gcc44 variant can compile universal binaries, whereas gcc42 and 43 cannot, right?

comment:4 in reply to:  3 Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to vince@…:

Then your gcc44 variant can compile universal binaries, whereas gcc42 and 43 cannot, right?

Yes, that is correct.
I could only get GCC 4.4 to work correctly, so it is used unless the user specifically asks for another version (in which case universal support is not possible).

comment:5 Changed 14 years ago by Veence (Vincent)

But how do you get Fortran sources compiled with gcc44 ?

comment:6 in reply to:  5 Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to vince@…:

But how do you get Fortran sources compiled with gcc44 ?

If no variants are selected, then gccversion is set to 4.4.

The code

configure.compiler  macports-gcc-${gccversion} 

sets configure.f77 to ${prefix}/bin/gfortran-mp-4.4

Then the code

configure.args      -C xc ${configure.cc} \
                    -C gc ${configure.cc} \
                    -C if ${configure.f77} \
                    -C ic ${configure.cc} \
                    -C dm ${configure.cc} \
                    -C sm ${configure.cc} \
                    -C dk ${configure.cc} \
                    -C sk ${configure.cc} \
                    --cc=${configure.cc} \
                    -b ${my_arch} \
                    -Fa alg -fPIC

tells the configure script which Fortran compiler to use.

comment:7 Changed 14 years ago by Veence (Vincent)

Ok, I am still puzzled that you can compile i386/x86_64 code without having the proper libs. For example, libptf77blas has a dependency to libgfortran, which is not universal unless you build it with --enable-multilib. Yet, I might be wrong.

comment:8 in reply to:  7 Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to vince@…:

Ok, I am still puzzled that you can compile i386/x86_64 code without having the proper libs. For example, libptf77blas has a dependency to libgfortran, which is not universal unless you build it with --enable-multilib. Yet, I might be wrong.

The muniversal PortGroup basically performs the configure, build, destroot, and test phases twice.
The first time, -m32 is passed to the fortran compiler to build i386 or ppc libraries.
The second time, -m64 is passed to build x86_64 or ppc64 libraries.
After the destroot phase, the muniversal PortGroup merges the two installations using, among other things, lipo to form a universal installation.

comment:9 Changed 14 years ago by Veence (Vincent)

Ok, I know this. What reports otool -L ${prefix}/lib/libptf77blas in your case? Here is mine:

otool -arch i386 -L libptf77blas.dylib
libptf77blas.dylib:
	/usr/pkg/lib/libptf77blas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/pkg/lib/gcc45/i386/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/usr/pkg/lib/libatlas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

otool -arch x86_64 -L libptf77blas.dylib
libptf77blas.dylib:
	/usr/pkg/lib/libptf77blas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/pkg/lib/gcc45/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/usr/pkg/lib/libatlas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

You see that the two versions (one for i386 and one for x86_64) link to the appropriate version of libgfortran.dylib. But, AFAIK, these two libgfortran libs are not generated unless you specify --enable-multilib when compiling gcc (without --enable-multilib, you get the one your default arch requires). Is your gcc44 built universal?

comment:10 in reply to:  9 Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to vince@…:

Ok, I know this. What reports otool -L ${prefix}/lib/libptf77blas in your case? Here is mine:

Here is the result:

otool -L /opt/local/lib/libptf77blas.dylib
/opt/local/lib/libptf77blas.dylib:
	/opt/local/lib/libptf77blas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/gcc44/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/local/lib/libatlas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)

otool -arch i386 -L /opt/local/lib/libptf77blas.dylib
/opt/local/lib/libptf77blas.dylib:
	/opt/local/lib/libptf77blas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/gcc44/i386/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/local/lib/libatlas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)

otool -arch x86_64 -L /opt/local/lib/libptf77blas.dylib
/opt/local/lib/libptf77blas.dylib:
	/opt/local/lib/libptf77blas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/gcc44/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/local/lib/libatlas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)

During the call to ld, I included -L${prefix}/lib/gcc${gccnumber}/${arch} before
-L${prefix}/lib/gcc${gccnumber} so that -lgfortran would find the correct architecture library.

I must admit that I do not know much about --enable-multilib, but I have not changed the gcc44 port,
and I seem to have both libraries.

comment:11 Changed 14 years ago by Veence (Vincent)

What is the output of gcc-mp-4.4 -v ?

Also, what do you get in ${prefix}/include/atlas ? Here, you should have include files with different values, one for 32 and one for 64bit. Ex:

more atlas_buildinfo.h
#ifdef __LP64__
#ifndef ATL_INSTINFO_H
   #define ATL_INSTINFO_H

#define ATL_ARCH "Core264SSE3"
#define ATL_INSTFLAGS "-1 0 -a 1"
#define ATL_F2CDEFS "-DAdd_ -DF77_INTEGER=int -DStringSunStyle"
#define ATL_ARCHDEFS "-DATL_OS_OSX -DATL_ARCH_Core2 -DATL_CPUMHZ=2400 -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664 -DATL_SSE3 -DATL_AVgcc"
#define ATL_DKCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m64"
#define ATL_DKC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_SKCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m64"
#define ATL_SKC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_DMCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m64"
#define ATL_DMC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_SMCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m64"
#define ATL_SMC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_ICCFLAGS "-DL2SIZE=4194304 -I/usr/pkg/var/macports/build/_Users_vincent_Developpement_ports_maths_atlas/work/atlas-3.8.3/build-64/include -I/usr/pkg/var/macports/build/_Users_vincent_Developpement_ports_maths_atlas/work/atlas-3.8.3/build-64/..//include -I/usr/pkg/var/macports/build/_Users_vincent_Developpement_ports_maths_atlas/work/atlas-3.8.3/build-64/..//include/contrib -DAdd_ -DF77_INTEGER=int -DStringSunStyle -DATL_OS_OSX -DATL_ARCH_Core2 -DATL_CPUMHZ=2400 -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_"
#define ATL_ICC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_F77FLAGS "-O -fPIC -m64"
[…]
#endif
#endif

#ifdef __LP32__
#ifndef ATL_INSTINFO_H
   #define ATL_INSTINFO_H

#define ATL_ARCH "Core232SSE3"
#define ATL_INSTFLAGS "-1 0 -a 1"
#define ATL_F2CDEFS "-DAdd_ -DF77_INTEGER=int -DStringSunStyle"
#define ATL_ARCHDEFS "-DATL_OS_OSX -DATL_ARCH_Core2 -DATL_CPUMHZ=2400 -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_GAS_x8632 -DATL_SSE3 -DATL_AVgcc"
#define ATL_DKCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m32"
#define ATL_DKC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_SKCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m32"
#define ATL_SKC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_DMCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m32"
#define ATL_DMC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_SMCFLAGS "-fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fPIC -m32"
#define ATL_SMC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_ICCFLAGS "-DL2SIZE=4194304 -I/usr/pkg/var/macports/build/_Users_vincent_Developpement_ports_maths_atlas/work/atlas-3.8.3/build-32/include -I/usr/pkg/var/macports/build/_Users_vincent_Developpement_ports_maths_atlas/work/atlas-3.8.3/build-32/..//include -I/usr/pkg/var/macports/build/_Users_vincent_Developpement_ports_maths_atlas/work/atlas-3.8.3/build-32/..//include/contrib -DAdd_ -DF77_INTEGER=int -DStringSunStyle -DATL_OS_OSX -DATL_ARCH_Core2 -DATL_CPUMHZ=2400 -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_GAS_x8632 -DATL_"
#define ATL_ICC "/usr/pkg/bin/gcc-mp-4.5"
#define ATL_F77FLAGS "-O -fPIC -m32"
[…]
#endif
#endif

(I have omitted lines which are the same for 32 and 64-bit builds)

comment:12 in reply to:  11 Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to vince@…:

What is the output of gcc-mp-4.4 -v ?

gcc-mp-4.4 -v gives

Using built-in specs.
Target: x86_64-apple-darwin10
Configured with: ../gcc-4.4.4/configure --prefix=/opt/local --build=x86_64-apple-darwin10 --enable-languages=c,c++,objc,obj-c++,java,fortran --libdir=/opt/local/lib/gcc44 --includedir=/opt/local/include/gcc44 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.4 --with-gxx-include-dir=/opt/local/include/gcc44/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --enable-stage1-checking --enable-fully-dynamic-string
Thread model: posix
gcc version 4.4.4 (GCC)

Also, what do you get in ${prefix}/include/atlas ? Here, you should have include files with different values, one for 32 and one for 64bit.

Each of the following files have an #ifndef __LP64__ statement in them:

atlas_buildinfo.h
atlas_cNCmm.h
atlas_cacheedge.h
atlas_cmv.h
atlas_cmvS.h
atlas_cmvT.h
atlas_cr1.h
atlas_csysinfo.h
atlas_dNCmm.h
atlas_dmv.h
atlas_dmvS.h
atlas_dmvT.h
atlas_dr1.h
atlas_dsysinfo.h
atlas_dtrsmXover.h
atlas_sNCmm.h
atlas_smv.h
atlas_smvS.h
atlas_sr1.h
atlas_ssysinfo.h
atlas_trsmNB.h
atlas_zNCmm.h
atlas_zmv.h
atlas_zmvS.h
atlas_zmvT.h
atlas_zr1.h
atlas_zsysinfo.h
cXover.h
cmm.h
dXover.h
dmm.h
sXover.h
smm.h
zXover.h
zmm.h

comment:13 Changed 14 years ago by SlaunchaMan (Jeff Kelley)

Cc: SlaunchaMan@… added

Cc Me!

comment:14 Changed 14 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: newclosed

Fixed in r68232 (maintainer timeout).

Note: See TracTickets for help on using tickets.