From m.pacey@lancaster.ac.uk  Tue Feb  4 17:54:41 2003
From: m.pacey@lancaster.ac.uk (m.pacey@lancaster.ac.uk)
Date: Tue Feb  4 17:54:41 2003
Subject: [Rd] Bug in configure script for Solaris v9 arch with libsunperf (PR#2530)
Message-ID: <200302041647.h14GlP9j006475@pubhealth.ku.dk>

System details: 
--------------

Sun Blade 1000, Solaris 8, Sun ONE Compiler Suite (rebranded Forte 7), R
versions 1.6.0 and 1.6.2 - suspect others are affected, too

Problem description: 
-------------------

Using the recommended env var setting from p.15 of the Admin Guide, the
configure script fails the sgemm sunperf test, even though the sunperf
libraries are available

Not linking with libsunperf causes drastic performance hits on some simple
benchmarks I've tried (e.g. matrix multiplication can take up to 100 times as
long for a sufficiently large matrix (n=5000))

Solution:
--------

Configure script should use the recommended flag for inclusion of the Sun
Performance Library: -xlic_lib=sunperf (ironically, the configure script sets
this flag up if the sgemm sunperf test passes!).

Quick fix: Add the recommended flag to the compiler env vars

Description:
-----------

I'm setting the following env vars before running configure, as per the admin
guide:

export PATH=/usr/ccs/bin:$PATH
export CC="cc -xarch=v9"
export CFLAGS="-xO5 -xlibmil -dalign"
export F77="f95 -xarch=v9"
export FFLAGS="-xO5 -xlibmil -dalign"
export CXX="CC"
export CXXFLAGS="-xO5 -xlibmil -dalign"

Config.log reports the following:

configure:19929: checking for sgemm_ in -lsunperf
configure:19966: cc -xarch=v9 -o conftest -xO5 -xlibmil -dalign
-I/usr/local/include -L/usr/local/
lib conftest.c -lsunperf -lsunmath -lnsl -lsocket -lreadline -ldl -ltermcap -lm
-L/usr/local/lib
 -lreadline -ldl -ltermcap -lm
-R/usr/local/packages/SUNWspro/lib/v9:/opt/SUNWspro/lib/v9 -L/usr/l
ocal/packages/SUNWspro/lib/v9 -L/usr/local/packages/SUNWspro/prod/lib/v9
-L/usr/ccs/lib/sparcv9 -L
/usr/lib/sparcv9 -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai
-lfminvai -lfmaxvai -lf
su -lsunmath >&5
Undefined                       first referenced
 symbol                             in file
_stack_grow
/usr/local/packages/SUNWspro/prod/lib/v9/libsunperf.a(pp_sgemm.o)
ld: fatal: Symbol referencing errors. No output written to conftest


Problem is the v9 version seems to require stack_grow(); the xlic_lib=sunperf
does the extra linking work required:

fs% cc -xarch=v9 sgemm.c -xlic_lib=sunperf -#
### Note: NLSPATH =
/usr/local/bin/../packages/SUNWspro/bin/../prod/bin/../lib/locale/%L/LC_MESSAGE
S/%N.cat:/usr/local/bin/../packages/SUNWspro/bin/../prod/bin/../../lib/locale/%
L/LC_MESSAGES/%N.cat
###     command line files and options (expanded):
### -xarch=v9 sgemm.c -xlic_lib=sunperf
/usr/local/bin/../packages/SUNWspro/bin/../prod/bin/acomp -i sgemm.c -y-fbe
-y/usr/local/bin/../packages/SUNWspro/bin/../prod/bin/fbe -y-xarch=v9 -y-o
-ysgemm.o -y-s -y-verbose -y-xmemalign=8s -xarch=v9 -fparam_ir -Qy
-D__SunOS_5_8 -D__SUNPRO_C=0x540 -D__SVR4 -D__unix -D__sun -D__sparcv9
-D__sparc -D__BUILTIN_VA_ARG_INCR -Xa -D__PRAGMA_REDEFINE_EXTNAME -Dunix -Dsun
-Dsparc -D__RESTRICT -I/usr/local/packages/SUNWspro/prod/include/cc
"-g/usr/local/bin/../packages/SUNWspro/bin/../prod/bin/cc -xarch=v9
-xlic_lib=sunperf -c " -D__SUN_PREFETCH -destination_ir=yabe
### Note: LD_LIBRARY_PATH =
/usr/local/packages/globus/lib:/usr/lib:/usr/local/lib
### Note: LD_LIBRARY_PATH_64 = /usr/lib/sparcv9:/usr/local/lib/sparcv9
### Note: LD_RUN_PATH = <null>
/usr/ccs/bin/ld /usr/local/packages/SUNWspro/prod/lib/v9/crti.o
/usr/local/packages/SUNWspro/prod/lib/v9/crt1.o
/usr/local/packages/SUNWspro/prod/lib/v9/values-xa.o
/usr/local/packages/SUNWspro/prod/lib/v9/stack_grow.o sgemm.o -lsunperf -lfui
-lfai -lfsu -lsunmath -lm -Y
"P,/usr/local/packages/SUNWspro/lib/v9:/usr/local/packages/SUNWspro/prod/lib/v9
:/usr/ccs/lib/sparcv9:/usr/lib/sparcv9" -Qy
"-R/usr/local/packages/SUNWspro/lib/v9:/opt/SUNWspro/lib/v9" -lc -Bdynamic -ldl
/usr/local/packages/SUNWspro/prod/lib/v9/crtn.o

-----

Dr Mike Pacey,                         Email: M.Pacey@lancaster.ac.uk
High Performance Systems Support,      Phone: 01524 593543
Information Systems Services,            Fax: 01524 844001
Lancaster University,
Lancaster LA1 4YW



[Rd] Bug in configure script for Solaris v9 arch with libsunperf (PR#2530)
m.pacey@lancaster.ac.uk