Trouble compiling with -mcmodel=medium and -liblapack.a

Hi there,

I’m trying to compile with CUDA FORTRAN (-Mcuda) but I’m getting some problems. It doesn’t seem to be able to compile with the -mcmodel=medium flag correctly… I get the following error:

make[1]: Entering directory `/home/mbdx6pn2/work/DivNCon/complete/para_optimized'
pgfortran -g  -g -Mcuda -mcmodel=medium -pc=80 -o muse.exe aabacd.o aabbcd.o aaint.o acceler_formd.o scf.o aclear.o adcore.o adcore_dener.o alcoef.o amove.o anavib.o atmges.o babbbc.o babbcd.o betakl.o betakl_dener.o bint.o calvab.o charge.o chkupd.o cntmas.o coallc.o cochek.o codump.o cofree.o coinfo.o coinit.o copy.o cuda_scf.o dang.o dcart.o derpar.o detmnt.o dguess.o diag.o diagi.o dihed.o dipole.o disp.o dodiis.o dqmmm.o ecoul.o edatom.o egint.o eigprt.o elatom.o energy.o expont.o extprm.o fact.o fconst.o fermi_energy.o fgr.o fill_coeff.o fock1.o fock1_temp.o fock2.o fock2_dener.o formd.o formxy.o fragdump.o fragread.o frcout.o frzfrc.o getcr1.o getcrd.o getst1.o getvab.o hcore1.o hcore2.o hcore2_dener.o hform.o hqmmm.o hqrii.o huckel.o hybrid.o iclear.o ijkl.o inidbg.o intpwp.o iter.o lock.o lowprt.o ltzero.o ludcmp.o m00m00.o m00m10.o m00m20.o m10m10.o m10m20.o m11m11.o m11m21.o m20m20.o m21m21.o m22m22.o matmul.o matout.o matprt.o meci.o mecih.o mecip.o mixges.o mmrepp.o mofi.o moldat.o moprt.o mulpop.o mxm.o norcor.o norout.o nucmm.o nucrep.o nucrep_dener.o onec2e.o overlp.o parchk.o param_init.o partxy.o pepnuc.o perm.o profil.o rabprt.o radint.o rdens.o rdges.o reada.o rotate.o rsp.o rspd.o schmdt.o setdbg.o shift.o sparkl.o spin.o split.o sqzero.o srotate.o ssmndo.o subformd.o svd.o swap.o test.o test1.o transd.o trvect.o vecprt.o vibfrq.o zdogrd.o stopper.o h2indo.o h2indo_intunroll.o h1indo.o f2indo.o f2indo_intunroll.o bonder.o angle.o gamma.o qmnuc.o wrichk.o gettim.o molset.o inichk.o aababc.o blockd.o  -L/usr/pgi/lib/ -llapack -lblas 
/opt/pgi/linux86-64/12.5/lib/liblapack.a(dlamch.o): In function `dlamc1_':
dlamch.f:(.text+0x3ae): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x411): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x41d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x46e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x483): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x4f7): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x4fd): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x503): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x530): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x539): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dlamch.f:(.text+0x582): additional relocation overflows omitted from the output
make[1]: *** [muse.exe] Error 2

…which appears to be a problem with linking to lapack.

Anyone have any ideas how I can solve this issue?

Thanks in advance,
Crip_crop

Hi Crip Crop,

The Lapack we ship is only compiled for use with the small memory model. You will need to either compile you’re own Lapack library with “-fpic” enabled (we simply ship a compiled version of the NetLib version) or use the shared ACML library found in “/opt/pgi/linux86-64/12.5/libso” directory.

Hope this helps,
Mat

Hi Mat,

linking to the -L/opt/pgi/linux86-64/12.5/libso library and removing the links to lapack results in the compiler not recognising the lapack routines:


/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./anavib.f:61: undefined reference to `dsyev_'
dodiis.o: In function `dodiis_':
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./dodiis.f:304: undefined reference to `dgelss_'
formd.o: In function `formd_':
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./formd.f:109: undefined reference to `dsyev_'
mofi.o: In function `mofi_':
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./mofi.f:115: undefined reference to `dsyev_'
mulpop.o: In function `mulpop_':
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./mulpop.f:189: undefined reference to `dsyev_'
shift.o: In function `shift_':
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./shift.f:143: undefined reference to `dgemm_'
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./shift.f:143: undefined reference to `dgemm_'
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./shift.f:189: undefined reference to `dgemm_'
vibfrq.o: In function `vibfrq_':
/home/mbdx6pn2/work/DivNCon/complete/para_optimized/./vibfrq.f:165: undefined reference to `dsyev_'
make[1]: *** [muse.exe] Error 2
make[1]: Leaving directory `/home/mbdx6pn2/work/DivNCon/complete/para_optimized'
make: *** [default] Error 2

If I include the lapack links I get the same error as I got previously… so I’m not sure that’s works unless I’m doing something wrong. You did mean to add a static library link to the makefile didn’t you?

Cheers,
Crip_crop

You did mean to add a static library link to the makefile didn’t you?

No. We only ship a static, non-fpic compiled, version of Lapack that can’t be used with the medium model model.

Instead, you need to use the shared ACML library, i.e. add “-L/opt/pgi/linux86-64/12.5/libso -lacml”. Or compile your own version of Lapack with PIC enabled.

  • Mat