Linking BLAS library with pgf95

I’m getting the following error:

/usr/bin/ld: cannot find /home/ccevallos/dftb+_final/prg_dftb/…/: File format not recognized
pgacclnk: child process exit status 1: /usr/bin/ld
/home/ccevallos/dftb+_final/prg_dftb/GNUmakefile:43: recipe for target ‘dftb+’ failed

I’m linking it this way:
LIB_BLAS = -L$(MAGMA)/lib -rpath $(MAGMA)/lib -lmagma -L$(CUDADIR)/lib64 -lcublas -lcudart -lm $(ROOT)/$

Do you have any insight into what the error might be?

Hi Caterina,

Can you please post the full link command and output?

The error is coming from the linker (ld) since the file being passed to it is in a format that’s not recognized. I think the “cannot find /home/ccevallos/dftb+_final/prg_dftb/…/” message is the file that it’s complaining about which might mean that one of your defines is in error and passing in a bad string. The “(ROOT)/” seems suspect to me since I’m not sure what this is expanding to.

Hopefully the full output will help show what’s going on.


Yes you were right about $(ROOT)/$ , I changed it to what was supposed to be there: $(ROOT)/libs/libutil.a. My Makefile looks like this:


MAGMA = /opt/magma
MKLROOT = /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl
CUDADIR = /usr/local/cuda

INCLUDES = -I ~/dftb+_final/libs

#CFLAGS = -O3 $(FPIC) -mp -fast -Mipa=fast,inline -DNDEBUG -DADD_ -DMAGMA_WITH_MKL -DMKL_ILP64
#FFLAGS = -O3 -DADD_ -Wall -Dmagma_devptr_t=“integer(kind=8)” -mp

-O3 $(FPIC) -fast -Mipa=fast,inline -DNDEBUG -DADD_ -i8

#------ END JACEK----

Fortran 90 compiler

FC90 =pgf95

Options for the Fortran 90 compiler

FC90OPT = -i8 -Mcuda -Mprof -O3 -mp $(INCLUDES)

Preprocessor (leave empty, if the compiler has a built in preprocessor)

CPP = cpp -traditional

Options for preprocessing


Postprocessing of the preprocessor output (add-on pipe)

CPPPOST = $(ROOT)/utils/fpp/ general


LN = $(FC90) $(FC90OPT)

Linker options

#LNOPT = -Bstatic

Override options for different DEBUG modes

ifeq ($(DEBUG),1)
FC90OPT = -g -Wall -std=f2003 -pedantic -fall-intrinsics -fbounds-check
ifeq ($(DEBUG),2)
FC90OPT = -g -Wall -std=f2003 -pedantic -fall-intrinsics -fbounds-check
ifeq ($(DEBUG),3)
FC90OPT = -g -Wall -std=f2003 -pedantic -fall-intrinsics -fbounds-check

How to link specific libraries

LIB_BLAS =-lblas -L$(MAGMA)/lib -rpath $(MAGMA)/lib -lmagma -L$(CUDADIR)/lib64 -lcublas -lcudart -lm LIBS

#-Mcuda -L$(MAGMA)/lib $(LIBS) -rpath $(MAGMA)/lib -lmagma -L$(CUDADIR)/lib64 -lm $(ROOT)/$ -lcublas -lcudart $(INCLUDES)
#LIB_LAPACK = -llapack
#LIB_BLAS = -lacml -lblas -lgfortran -lpthread

This dftb.o is the executable I’m trying to generate.
The error is in bold letters:

cpp -traditional -DDEBUG=0 -I/home/ccevallos/dftb+_final/prg_dftb/ -I/home/ccevallos/dftb+_final/prg_dftb/…/includes /home/ccevallos/dftb+_final/prg_dftb/dftb+.F90 | /home/ccevallos/dftb+_final/prg_dftb/…/utils/fpp/ general > dftb+.f90
pgf95 -i8 -Mcuda -Mprof -O3 -mp -I ~/dftb+_final/libs -I/usr/local/cuda/include -I/opt/magma/include -I/opt/magma/control -I/opt/magma/sparse/include -o dftb+.o -c dftb+.f90
pgf95 -i8 -Mcuda -Mprof -O3 -mp -I ~/dftb+final/libs -I/usr/local/cuda/include -I/opt/magma/include -I/opt/magma/control -I/opt/magma/sparse/include -o dftb+ dftb+.o shift.o accuracy.o common_types.o allocate.o geoopt.o conjgrad.o linmin.o constants.o stepdesc.o mainio.o sparse2dense.o memman.o periodic.o lapackroutines.o message.o sort.o bisection.o linkedlist.o simple_algebra.o fileid.o blasroutines.o fifo.o charmanip.o initprogram.o disp_uff.o disp_common.o diis_mixer.o scc.o coulomb.o extcharge.o charge_constraints.o short_gamma.o dummy_thermostat.o md_common.o ranlux.o slako_cont.o slako_eq_grid.o interpolation.o orbital_equiv.o nhc_thermostat.o energies.o temp_profile.o simple_mixer.o numericalDerivs.o thermostat.o berendsen_thermostat.o andersen_thermostat.o spin.o disp_slaterkirkwood.o broyden_mixer.o thirdorder.o md_integrator.o velocity_verlet.o inputdata.o rep_cont.o rep_poly.o rep_spline.o dispersion.o type_geometry.o intrinsicpr.o mixer_adt.o anderson_mixer.o scc_init.o dftb_pls_u.o eigensolver.o flib_wxml.o m_wxml_core.o m_wxml_elstack.o m_wxml_buffer.o m_wxml_dictionary.o m_wxml_text.o nonscc.o sk.o populations.o constraints.o angmomentum.o qm.o potentials.o formatout.o eigenvects.o parser.o stringlist.o m_strings.o hsdutils2.o hsdparser.o xmlutils.o flib_dom.o m_dom_nodelist.o m_dom_types.o m_dom_utils.o m_dom_document.o m_dom_namednodemap.o m_dom_node.o m_dom_error.o m_dom_debug.o m_dom_element.o m_dom_attribute.o m_dom_parse.o flib_sax.o m_xml_parser.o m_elstack.o m_buffer.o m_fsm.o m_entities.o m_dictionary.o m_charset.o m_debug.o m_reader.o m_io.o m_xml_error.o m_converters.o hsdutils.o tokenreader.o unitconversion.o disp_uff_data.o general_list.o oldcompat.o wrapped_pointers.o type_geometry_hsd.o old_sk_data.o stressTensor.o taggedout.o densitymatrix.o etemp.o hermite.o ext_erfc.o fact.o repulsive.o spinorbit.o forces.o -lblas -L/opt/magma/lib -rpath /opt/magma/lib -lmagma -L/usr/local/cuda/lib64 -lcublas -lcudart -lm /home/ccevallos/dftb+final/prg_dftb/…/libs/libutil.a
/usr/bin/ld: /opt/magma/lib/libmagma.a(thread_queue.o): undefined reference to symbol ‘_ZTVSt9exception@@GLIBCXX_3.4
//usr/lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
pgacclnk: child process exit status 1: /usr/bin/ld
/home/ccevallos/dftb+_final/prg_dftb/GNUmakefile:43: recipe for target ‘dftb+’ failed
make[1]: *** [dftb+] Error 2

rm disp_common.f90 md_integrator.f90 short_gamma.f90 spin.f90 taggedout.f90 md_common.f90 geoopt.f90 memman.f90 tokenreader.f90 dftb+.f90 slako_eq_grid.f90 inputdata
.f90 fifo.f90 rep_poly.f90 sparse2dense.f90 populations.f90 sort.f90 disp_uff.f90 type_geometry.f90 densitymatrix.f90 fact.f90 eigensolver.f90 hsdutils.f90 dftb_pls_u.f90 andersen_thermostat.f90 allocate.f90 initprogram.f90 broyden_mixer.f90 dispersion.f90 orbital_equiv.f90 xmlutils.f90 qm.f90 sk.f90 forces.f90 wrapped_pointers.f90 ext_erfc.f90 linmin.f90 diis_mixer.f90 mainio.f90 repulsive.f90 formatout.f90 accuracy.f90 mixer_adt.f90 general_list.f90 hermite.f90 shift.f90 hsdparser.f90 lapackroutines.f90 old_sk_data.f90 eigenvects.f90 type_geometry_hsd.f90 berendsen_thermostat.f90 linkedlist.f90 velocity_verlet.f90 charmanip.f90 slako_cont.f90 scc.f90 energies.f90 numericalDerivs.f90 disp_slaterkirkwood.f90 spinorbit.f90 potentials.f90 disp_uff_data.f90 parser.f90 blasroutines.f90 stressTensor.f90 thermostat.f90 angmomentum.f90 constraints.f90 nhc_thermostat.f90 nonscc.f90 stringlist.f90 periodic.f90 bisection.f90 hsdutils2.f90 temp_profile.f90 intrinsicpr.f90 oldcompat.f90 scc_init.f90 unitconversion.f90 extcharge.f90 charge_constraints.f90 simple_algebra.f90 rep_spline.f90 common_types.f90 dummy_thermostat.f90 conjgrad.f90 etemp.f90 message.f90 simple_mixer.f90 thirdorder.f90 stepdesc.f90 rep_cont.f90 fileid.f90 coulomb.f90 constants.f90 interpolation.f90 anderson_mixer.f90 ranlux.f90
make[1]: Leaving directory ‘/home/ccevallos/dftb+_final/prg_dftb/_obj_x86_64-linux-pgi-gpu’
…/Makefile.objdir:69: recipe for target ‘_obj_x86_64-linux-pgi-gpu’ failed
make: *** [_obj_x86_64-linux-pgi-gpu] Error 2

I’ve not used MAGMA myself, but it looks like it’s C++. In which case, you’ll need to add the C++ runtime library, “-lstdc++” to your link. Alternatively, you can add the PGI flag “-pgc++libs” which will bring it in for you.