Opened 12 years ago

Closed 12 years ago

#435 closed enhancement (fixed)

avoid using -m64 if possible

Reported by: Peter Owned by: Jari Häkkinen
Priority: minor Milestone: yat 0.6
Component: build Version: trunk
Keywords: Cc:

Description

related to ticket:349

When using atlas, a -m64 flag is always set without checking if it is needed. I think we should first try without the flag, and if it does not work add the flag.

Change History (3)

comment:1 Changed 12 years ago by Jari Häkkinen

The -m64 was added in changeset:969

In ticket:118 there is a comment that I need -m64 on my machine. If I remember correctly I think it is because I only have a 64 bit version of atlas. There is a comment near the end saying that the -m64 option should be tested with a 32 bit machine, it seems like it never was.

comment:2 Changed 12 years ago by Peter

I think my machine is 32-bit

$ arch
i686

I tested the cblas detection in a few different ways:

1)

$ autoreconf -v && ./configure --enable-debug 
configure: checking for libraries
checking for cos in -lm... yes
checking for library containing cblas_sdsdot... no
checking for library containing ATL_sdsdot... no
checking for library containing cblas_dswap... -lgslcblas
checking for gsl-config... /usr/bin/gsl-config
checking for GSL - version >= 1.8... yes

that is nothing is found except the last option that is gslcblas.

2)

$ autoreconf -v && ./configure --enable-debug LDFLAGS=-L/usr/lib/atlas
configure: checking for libraries
checking for cos in -lm... yes
checking for library containing cblas_sdsdot... -lcblas
checking for gsl-config... /usr/bin/gsl-config
checking for GSL - version >= 1.8... yes

that is cblas, the first option, is found.

3)

$ svn diff
 atlas_found="no"
 gslcblas_found="no"    # gslcblas_found may get values yes or no
-AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
+AC_SEARCH_LIBS(BOGUScblas_sdsdot,cblas,cblas_found="yes",
   AC_SEARCH_LIBS(ATL_sdsdot,atlas,
     AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes",
$ autoreconf -v && ./configure --enable-debug LDFLAGS=-L/usr/lib/atlas
configure: checking for libraries
checking for cos in -lm... yes
checking for library containing BOGUScblas_sdsdot... no
checking for library containing ATL_sdsdot... no
checking for library containing cblas_dswap... -lgslcblas
checking for gsl-config... /usr/bin/gsl-config
checking for GSL - version >= 1.8... yes

Here, I've polluted the tests for cblas in order to see how the atlas test turns out. It is not successful.

4)

$ svn diff
 gslcblas_found="no"    # gslcblas_found may get values yes or no
-AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
+AC_SEARCH_LIBS(BOGUScblas_sdsdot,cblas,cblas_found="yes",
   AC_SEARCH_LIBS(ATL_sdsdot,atlas,
     AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes",
-                   atlas_found="partial",-m64),
-      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),)
+                   atlas_found="partial"),
+      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes")),)
 # CBLAS used in test of GSL
$ autoreconf -v && ./configure --enable-debug LDFLAGS=-L/usr/lib/atlas
configure: checking for libraries
checking for cos in -lm... yes
checking for library containing BOGUScblas_sdsdot... no
checking for library containing ATL_sdsdot... -latlas
checking for library containing cblas_sdsdot... -lcblas
checking whether the C++ compiler accepts the -m64 flag... no
checking whether the linker accepts the -m64 flag... no
checking for gsl-config... /usr/bin/gsl-config

If I remove the -m64 flags, however, atlas is detected. Also note that compiler and linker tests of the -m64 fail, which is expected I suppose.

Interestingly, after building with alternative 2), I issue:

$ ldd yat/.libs/libyat.so
        linux-gate.so.1 =>  (0x00110000)
        libgsl.so.0 => /usr/lib/libgsl.so.0 (0x001ba000)
        libcblas.so.3 => /usr/lib/sse2/libcblas.so.3 (0x00386000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x003a5000)
        libm.so.6 => /lib/libm.so.6 (0x00490000)
        libc.so.6 => /lib/libc.so.6 (0x004b9000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00612000)
        libatlas.so.3 => /usr/lib/sse2/libatlas.so.3 (0x00719000)
        /lib/ld-linux.so.2 (0x006fc000)

which I interpret as though cblas is linked in from the ATLAS package.

So my question is: when will I fall back on the second option, i.e., -latlas. Well, apparently you do that, but isn't that just a race between 32-bit and 64-bit. It would be interesting to see how the detection turns out on your machine if you use -m64 flags also in the first cblas test.

A related thing is that the GSL Manual suggests to link with a CBLAS library called libcblas as

$ gcc example.o -lgsl -lcblas -lm

or when linking with the cblas interface of the atlas library

$ gcc example.o -lgsl -lcblas -latlas -lm

I'm getting a bit dizzy here, but through the fog I think I can see that here are some room for improvements.

comment:3 Changed 12 years ago by Peter

Milestone: yat 0.x+yat 0.6
Resolution: fixed
Status: newclosed

As of r1914 we use ACX_BLAS and there is no -m64 flag.

Note: See TracTickets for help on using tickets.