compile gotoblas with pgi7.04

Hi, all

When I compile gotoblas1.05 to a 64bit static library (on a AMD64 system) using pgi7.04 as the fortran compiler, no problem occurs. However, when I built the shared library, error occurs:

./gensymbol linux _ > linux.def
gcc -O2 -DALLOC_HUGETLB -D__64BIT__ -D_GNU_SOURCE -Wall -fPIC -m64 -DF_INTERFACE_F2C -DMAX_CPU_NUMBER=2 -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DBUNDERSCORE=_ -DNEEDBUNDERSCORE -I… -DARCH_X86_64 -DOPTERON -DL1_CODE_SIZE=65536 -DL1_CODE_ASSOCIATIVE=2 -DL1_CODE_LINESIZE=64 -DL1_DATA_SIZE=65536 -DL1_DATA_ASSOCIATIVE=2 -DL1_DATA_LINESIZE=64 -DL2_SIZE=1048576 -DL2_ASSOCIATIVE=8 -DL2_LINESIZE=64 -DITB_SIZE=4096 -DITB_ASSOCIATIVE=0 -DITB_ENTRIES=32 -DDTB_SIZE=4096 -DDTB_ASSOCIATIVE=0 -DDTB_ENTRIES=32 -DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_3DNOWEX -DHAVE_3DNOW -DHAVE_CFLUSH -DNUM_SHAREDCACHE=1 -DNUM_CORES=1 -DCORE_OPTERON -shared -o …/libgoto_opteron-r1.05.so
-Wl,–whole-archive …/libgoto_opteron-r1.05.a -Wl,–no-whole-archive
-Wl,–retain-symbols-file linux.def
/usr/bin/ld: …/libgoto_opteron-r1.05.a(srot.o): relocation R_X86_64_PC32 against `__pgio_ini’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** […/libgoto_opteron-r1.05.so] Error 1

Any suggestions?

Thanks in advance.

Hi hlzya,

How did you create libgoto_opteron-r1.05.a?

My best guess is that either you didn’t compile with “-fpic” or when the libgoto_opteron-r1.05.a was created, you also archived the pgi static runtime libraries from the PGI “lib” directory. If the later is the case, then be sure to use the static libraries found in the “libso” directory. The static libraries in “libso” were all compiled with “-fpic”, while those in “lib” were not.

Hope this helps,
Mat

Hi, Mat

Thank you for your reply.

I have tried PGI 6.1.6 too, and no problem is found when I create the shared library.

When I compiled gotoblas, I only modified the “Makefile.rule” file: using F_COMPILER = PGI and BINARY64 = 1, and did not change anything else. Both PGI7.07 and PGI 6.1.6 work well when compiling the static library. However, when I create the shared library using PGI 7.04, the above mentioned errors occur.

Yi-An

Hi Yi-An,

Try changing the PGI section of “Makefile.rules” to “libso” instead of “lib”. This should bring in the PGI runtime libraries that were compiled with “-fpic”. I was able to compile and link both the static and dynamic library with thsi change.

ifeq ($(F_COMPILER), PGI)
COMPILER_F77 = pgf77
BU            = _
CCOMMON_OPT  += -DF_INTERFACE_F2C
FCOMMON_OPT += -fPIC
COMMON_PROF +=  -DPGICOMPILER

ifndef BINARY64
PGCPATH = $(shell which pgcc | sed -e 's/bin\/pgcc//;s/linux86-64/linux86/')
#EXTRALIB    += -L$(PGCPATH)lib -Wl,-rpath,$(PGCPATH) -lpgftnrtl -lpgc
EXTRALIB    += -L$(PGCPATH)libso -Wl,-rpath,$(PGCPATH) -lpgftnrtl -lpgc
else
PGCPATH = $(shell which pgcc | sed -e 's/bin\/pgcc//')
XTRALIB    += -L$(PGCPATH)lib -Wl,-rpath,$(PGCPATH) -lpgftnrtl -lpgc
ifdef INTERFACE64
FCOMMON_OPT += -i8
endif
endif
  • Mat

Hi Mat,

I have tried your suggestion, while it stil dose not work.

Are you sure you are using the most recent PGI7.04?

When I use the PGI6.16, I have not modified the “lib” to “libso” in the Makefile.rule, and the shared library can be created without any errors.

Thank you very much for your kind attention.

Yi-An

Hi Yi-An,

Can you please post the exact steps you did so I can try an reproduce the error here. While I did use 7.0-4 without problems, perhaps I’m missing something. Besure to include the gotoblas version number and include all steps such as untaring the package, your configuration, make commands, etc.

Thanks,
Mat

Hi mkcolg,

The steps are as follows:

  1. Now, the Gotoblas version number I am using is v 1.14.

  2. The processor in my cluser is AMD Opteron X64.

  3. The system is CentOS 4.4.

  4. Firstly, “tar zxvf GotoBLAS-1.14.tar.gz”.

  5. Then, modify the “Makefile.rule” file: uncomment “C_COMPILER = GNU”, “F_COMPILER = PGI”, “BINARY64 = 1” and modify

ifndef BINARY64
PGCPATH = $(shell which pgcc | sed -e ‘s/bin/pgcc//;s/linux86-64/linux86/’)
EXTRALIB += -L$(PGCPATH)lib -Wl,-rpath,$(PGCPATH) -lpgftnrtl -lpgc
else
PGCPATH = $(shell which pgcc | sed -e ‘s/bin/pgcc//’)
XTRALIB += -L$(PGCPATH)lib -Wl,-rpath,$(PGCPATH) -lpgftnrtl -lpgc
ifdef INTERFACE64
FCOMMON_OPT += -i8

with

ifndef BINARY64
PGCPATH = $(shell which pgcc | sed -e ‘s/bin/pgcc//;s/linux86-64/linux86/’)
EXTRALIB += -L$(PGCPATH)libso -Wl,-rpath,$(PGCPATH) -lpgftnrtl -lpgc
else
PGCPATH = $(shell which pgcc | sed -e ‘s/bin/pgcc//’)
XTRALIB += -L$(PGCPATH)lib -Wl,-rpath,$(PGCPATH) -lpgftnrtl -lpgc
ifdef INTERFACE64
FCOMMON_OPT += -i8

  1. make

  2. “cd exports” and “make so”

Then, errors occur, while using PGI6.16, the shared library is successfully created.

Thank you very much for your kind attention.

Yi-An

Hi Yi-An,

While these were the exact step I did previously, I tried again. The good/bad news is that it still worked fine for me. The only difference is that I’m using SLES9 instead of CentOS.

What is the output of ‘uname -r’ and ‘gcc --version’ on your system?

Thanks,
Mat

/tmp/GotoBLAS% cd exports/
Directory: /tmp/GotoBLAS/exports
octagon:/tmp/GotoBLAS/exports% make so
./gensymbol linux _ 1 > linux.def
gcc -O2 -D__64BIT__ -D_GNU_SOURCE -Wall -fPIC  -m64 -DF_INTERFACE_F2C -DMAX_CPU_NUMBER=8 -DEXPRECISION -m128bit-long-double -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DBUNDERSCORE=_ -DNEEDBUNDERSCORE -I.. -DARCH_X86_64 -DOPTERON -DL1_CODE_SIZE=65536 -DL1_CODE_ASSOCIATIVE=2 -DL1_CODE_LINESIZE=64 -DL1_DATA_SIZE=65536 -DL1_DATA_ASSOCIATIVE=2 -DL1_DATA_LINESIZE=64 -DL2_SIZE=1048576 -DL2_ASSOCIATIVE=8 -DL2_LINESIZE=64 -DITB_SIZE=4096 -DITB_ASSOCIATIVE=0 -DITB_ENTRIES=32 -DDTB_SIZE=4096 -DDTB_ASSOCIATIVE=0 -DDTB_ENTRIES=32 -DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_3DNOWEX -DHAVE_3DNOW -DHAVE_CFLUSH -DNUM_SHAREDCACHE=1 -DNUM_CORES=1 -DCORE_OPTERON  -shared -o ../libgoto_opteron-r1.14.so \
-Wl,--whole-archive ../libgoto_opteron-r1.14.a -Wl,--no-whole-archive \
-Wl,--retain-symbols-file=linux.def
./gensymbol linktest _  1 > linktest.c
gcc -O2 -D__64BIT__ -D_GNU_SOURCE -Wall -fPIC  -m64 -DF_INTERFACE_F2C -DMAX_CPU_NUMBER=8 -DEXPRECISION -m128bit-long-double -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DBUNDERSCORE=_ -DNEEDBUNDERSCORE -I.. -DARCH_X86_64 -DOPTERON -DL1_CODE_SIZE=65536 -DL1_CODE_ASSOCIATIVE=2 -DL1_CODE_LINESIZE=64 -DL1_DATA_SIZE=65536 -DL1_DATA_ASSOCIATIVE=2 -DL1_DATA_LINESIZE=64 -DL2_SIZE=1048576 -DL2_ASSOCIATIVE=8 -DL2_LINESIZE=64 -DITB_SIZE=4096 -DITB_ASSOCIATIVE=0 -DITB_ENTRIES=32 -DDTB_SIZE=4096 -DDTB_ASSOCIATIVE=0 -DDTB_ENTRIES=32 -DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_3DNOWEX -DHAVE_3DNOW -DHAVE_CFLUSH -DNUM_SHAREDCACHE=1 -DNUM_CORES=1 -DCORE_OPTERON  -w -o linktest linktest.c ../libgoto_opteron-r1.14.so  -lm && echo OK.
OK.
rm -f linktest

Hi mkcolg,

The ourput of “uname -r” is “2.6.9-42.ELsmp”, and the output of “'gcc --version” is

“gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.”

Thanks,

Yi-An

Hi Yi-An,

The closest matching system I have access to is SuSE 9.3 but again it just worked. Is it possible for me to access your system so I can try and determine the error? If so, please write to trs@pgroup.com with instructions and ask customer service to forward your message to me. Otherwise, I’m out of ideas.

Sorry,
Mat

Hi mkcolg,

The cluster in our university is IP-restricted. Therefore, I am sorry that I can not let you access my system.

I will continue to find out the reson for the mistake. When I get it, I will let you know as soon as possible.

Thank you very much again.

Yi-An