Newbie - Plasma linking

Open forum for general discussions relating to PLASMA.

Newbie - Plasma linking

Postby jacob.lost » Tue Dec 08, 2009 1:30 am

hello dear!

I'm new to plasma and have a question that may sounds stupid..

I successfully installed PLASMA on my Ubuntu using installer script and the following line:

./setup.py --cc gcc --fc gfortran --blaslib="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread"

All tests executed fine.

However, when I try to compile my code calling PLASMA, some undefined reference errors are shown..
For instance, I tried to compile the file "example_dgesv.c" from /build/plasma_2.1.0/examples/ as follows:

$gcc example_dgesv.c -o dgesvTest -lcblas -lcorelapack -lcoreblas -lplasma -lmkl_gf -lmkl_sequential -lmkl_core -lguide -lpthread -lm

First I changed the start of file:

//#include <cblas.h>
//#include <plasma.h>
#include "../src/lapack.h"
#include "../include/cblas.h"
#include "../include/plasma.h"
#include <math.h>

The compilation result is:

/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dormqr':
core_dblas.c:(.text+0x7d): undefined reference to `core_dormqr_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dormlq':
core_dblas.c:(.text+0x10d): undefined reference to `core_dormlq_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dtstrf':
core_dblas.c:(.text+0x188): undefined reference to `core_dtstrf_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dtsqrt':
core_dblas.c:(.text+0x1ea): undefined reference to `core_dtsqrt_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dtslqt':
core_dblas.c:(.text+0x24a): undefined reference to `core_dtslqt_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dssssm':
core_dblas.c:(.text+0x38f): undefined reference to `core_dssssm_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dssmqr':
core_dblas.c:(.text+0x432): undefined reference to `core_dssmqr_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dssmlq':
core_dblas.c:(.text+0x4d2): undefined reference to `core_dssmlq_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dgetrf':
core_dblas.c:(.text+0x557): undefined reference to `core_dgetrf_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dgessm':
core_dblas.c:(.text+0x5ac): undefined reference to `core_dgessm_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dgeqrt':
core_dblas.c:(.text+0x60c): undefined reference to `core_dgeqrt_'
/usr/local/lib/libplasma.a(core_dblas.o): In function `CORE_dgelqt':
core_dblas.c:(.text+0x6dc): undefined reference to `core_dgelqt_'
collect2: ld returned 1 exit status

Please, could you help me with compiling/linking process?

Thank you, Jacob
jacob.lost
 
Posts: 3
Joined: Mon Dec 07, 2009 9:07 am

Re: Newbie - Plasma linking

Postby luszczek » Tue Dec 08, 2009 2:28 am

Dear Jacob,

from looking at your link line I'm guessing you're missing the directory where PLASMA libraries are located:
-L/build/plasma_2.1.0/lib

Also, the order of the libraries is a bit off.

I would link like this:
gcc example_dgesv.c -o dgesvTest -L/build/plasma_2.1.0/lib -lplasma -lcoreblas -lcorelapack -lcblas -lmkl_gf -lmkl_sequential -lmkl_core -lguide -lpthread -lm

Piotr
luszczek
 
Posts: 15
Joined: Tue Jul 14, 2009 2:10 pm

Re: Newbie - Plasma linking

Postby jacob.lost » Tue Dec 08, 2009 3:10 am

Dear Piotr,

Including libs directory and changing the order of linking I got these messages:

/home/jcb/Desktop/plasma-installer/lib/libcorelapack.a(plasma_ilaenv.o): In function `plasma_ilaenv_':
plasma_ilaenv.f:(.text+0x71): undefined reference to `_gfortran_compare_string'
plasma_ilaenv.f:(.text+0x99): undefined reference to `_gfortran_compare_string'
plasma_ilaenv.f:(.text+0xc1): undefined reference to `_gfortran_compare_string'
plasma_ilaenv.f:(.text+0xe9): undefined reference to `_gfortran_compare_string'
plasma_ilaenv.f:(.text+0x111): undefined reference to `_gfortran_compare_string'
/home/jcb/Desktop/plasma-installer/lib/libcorelapack.a(plasma_ilaenv.o):plasma_ilaenv.f:(.text+0x135): more undefined references to `_gfortran_compare_string' follow
/home/jcb/Desktop/plasma-installer/lib/libcorelapack.a(xerbla.o): In function `xerbla_':
xerbla.f:(.text+0x50): undefined reference to `_gfortran_st_write'
xerbla.f:(.text+0x67): undefined reference to `_gfortran_transfer_character'
xerbla.f:(.text+0x7e): undefined reference to `_gfortran_transfer_integer'
xerbla.f:(.text+0x86): undefined reference to `_gfortran_st_write_done'
xerbla.f:(.text+0x92): undefined reference to `_gfortran_stop_numeric'
collect2: ld returned 1 exit status

Do you know what's the problem? Thank you very much!
jacob.lost
 
Posts: 3
Joined: Mon Dec 07, 2009 9:07 am

Re: Newbie - Plasma linking

Postby luszczek » Tue Dec 08, 2009 12:26 pm

You need to add -lgfortran at the end of link line. Or use gfortran as the linker instead of gcc.

Piotr
luszczek
 
Posts: 15
Joined: Tue Jul 14, 2009 2:10 pm

Re: Newbie - Plasma linking

Postby jacob.lost » Thu Dec 10, 2009 6:04 am

Dear Piotr,
It worked with -lgfortran :D thanks for your help!
jacob.lost
 
Posts: 3
Joined: Mon Dec 07, 2009 9:07 am

Re: Newbie - Plasma linking

Postby hpc-matt » Wed May 05, 2010 4:47 am

I am attempting to compile my own program, however I am running into a similar program.

I have noticed that you have been linking into the libs directory under the build dir. This contains no files for me, they are all at the /plasma-installer/libs level. Is this incorrect? According to the installation script, we should be able to delete the entire build directory.

My specific errors include:
if I do not include the /include directory in my compile line, I get the following
-Cannot open header file "plasma_z.k"


If I do include it, I get:

/opt/PLASMA/plasma-installer/lib/libcorelapack.a(plasma_ilaenv.o): In function `plasma_ilaenv_':
plasma_ilaenv.f:(.text+0x11c): undefined reference to `for_cpystr'
/opt/PLASMA/plasma-installer/lib/libcorelapack.a(iparmq.o): In function `iparmq_':
iparmq.f:(.text+0x9c): undefined reference to `f_lanint_val'
/opt/PLASMA/plasma-installer/lib/libcorelapack.a(xerbla.o): In function `xerbla_':
xerbla.f:(.text+0x45): undefined reference to `for_write_seq_fmt'
xerbla.f:(.text+0x62): undefined reference to `for_write_seq_fmt_xmit'
xerbla.f:(.text+0x7f): undefined reference to `for_stop_core'

Does anyone know what seems to be the problem? Or can someone link to any documentation describing the proper make file constructs for this package?

Thanks,
Matt

EDIT: Here is my makefile, Sorry for the confusion and long post:


#/////////////////// P /// L /// A /// S /// M /// A //////////////////
#/// PLASMA is a software package provided by Univ. of Tennessee, ///
#/// Univ. of California Berkeley and Univ. of Colorado Denver ///
#//////////// M /// A /// K /// E /// . /// I /// N /// C /////////////

#///////////// U /// S /// E /// R ////// P /// A /// R /// T //////////

PLASMA_DIR = /opt/PLASMA/plasma-installer

CC = icc
FC = ifort
LINKER = $(FC)

ARCH = ar
ARCHFLAGS = cr
RANLIB = /usr/bin/ranlib

OPTS = -lgfortran -diag-disable vec -DADD_ -w
FOPTS = -O2 -diag-disable vec -fltconsistency -fp_port
LDOPTS = -nofor_main

LIBBLAS = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core

#/////Following lines are old link to MKL for other projects
#added by Matthew
MKLLIBDIR = /opt/intel/Compiler/11.1/038/mkl/lib/em64t
LIBS = $(MKLLIBDIR)/libmkl_intel_lp64.a
LIBS += -Wl,--start-group -L$(MKLLIBDIR) $(MKLLIBDIR)/libmkl_intel_thread.a $(MKLLIBDIR)/libmkl_core.a -Wl,--end-group -L$(MKLLIBDIR) -liomp5 -lpthread
#/////

#///// D /// O ////// N /// O /// T ////// T /// O /// U /// C /// H /////

# Include directory
INC = -I$(PLASMA_DIR)/build/plasma_2.1.0/include

# Location of the libraries.
LIBDIR = -L$(PLASMA_DIR)/lib

# Location and name of the PLASMA library.
LIBCBLAS = $(PLASMA_DIR)/lib/libcblas.a
LIBCORELAPACK = $(PLASMA_DIR)/lib/libcorelapack.a
LIBCOREBLAS = $(PLASMA_DIR)/lib/libcoreblas.a
LIBPLASMA = $(PLASMA_DIR)/lib/libplasma.a

# All libraries required by the tester.
LIB = -lplasma -lcoreblas -lcorelapack -lcblas $(LIBBLAS) -lpthread -lm

#//////////////////////////////////////////////////////////////////////////


ALLOBJ =makematrix.c \
MatrixMath.c \
PLASMA_QDWH.c

QDWH: $(ALLOBJ) QDWHDriver.o
$(CC) $(ALLOBJ) QDWHDriver.c -o $@ $(LIBDIR) $(LIB) $(OPTS)

clean:
rm -f *.o *~ *.a
hpc-matt
 
Posts: 2
Joined: Wed May 05, 2010 4:41 am

Re: Newbie - Plasma linking

Postby admin » Wed May 05, 2010 9:39 am

Matthew,
Unfortunately, you are looking at a very old version of the installer.
There is a new release scheduled for July 4th with a much better installer.
It looks like a problem with the linking sequence.
Try to change it manually.
The bottom line is that the installer just downloads PLASMA and creates the make.inc.
In principle you could download the tarball and create the make.inc by hand based on one of the example make.inc's.
The installer in the version 2.1 was a little ad-hoc.
But with a little persistence you should be able to make it work.
Jakub
admin
Site Admin
 
Posts: 79
Joined: Wed May 13, 2009 1:27 pm

Re: Newbie - Plasma linking

Postby hpc-matt » Wed May 05, 2010 3:43 pm

Is there a know problem in compiling the libraries? I have changed my linking line to be nearly identical to the one above in this post, yet no luck so far. I am using Intel's C compiler, will this change the FORTRAN linking at all? Any help is appreciated, I will try to rebuild PLASMA by hand to see if this will help.

Matt
hpc-matt
 
Posts: 2
Joined: Wed May 05, 2010 4:41 am


Return to User discussion

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests

cron