Problem - Extending Python with Plasma

Open forum for general discussions relating to PLASMA.

Problem - Extending Python with Plasma

Postby Bernardelli » Wed Jul 31, 2013 9:37 am

Hello everyone!

I need some help with extending Python with Plasma. I'm working on a project which needs to wrapp some Plasma contents on Python, but I'm getting some OSerror and I don't know what to do. I tried many things, but none worked. I'm testing the file example_dgesv.c, which compiled without any problems. I'm using a module called CTYPES to open the file(which I called libfoo.so).

To compile, I'm using this Makefile:
Code: Select all
# Makefile para programas basicos com Plasma
# Criado e revisto por Andre Leon S. Gradvohl em 13/9/2011

#Substitua o diretorio a seguir pelo diretorio onde esta instalado o plasma-installer_2.4.1
PLASMA_DIR=/home/gradvohl/plasma/plasma-installer_2.4.1/build/plasma_2.4.1
include $(PLASMA_DIR)/make.inc

CC=gcc
#Diretorios incluidos (onde procurar os headers .h)
INCLUDE=-I$(PLASMA_DIR)/include \
        -I$(PLASMA_DIR)/quark \
        -I$(PLASMA_DIR)/../lapacke-3.3.0/include

#Diretorios incluidos (onde procurar as bibliotecas libXXX.a)
INCLUDE_LIBS=-L$(PLASMA_DIR)/lib \
             -L$(PLASMA_DIR)/quark \
             -L$(PLASMA_DIR)/../CBLAS/lib \
             -L$(PLASMA_DIR)/../lapacke-3.3.0 \
             -L$(PLASMA_DIR)/../lapack-3.3.1 \
             -L$(PLASMA_DIR)/../BLAS

#Bibliotecas a serem incorporadas ao programa
PLASMA_LIB=-lplasma \
           -lcoreblas \
           -lquark \
           -lcblas \
           -llapacke \
           -llapack \
           -ltmg  \
           -lrefblas
LIB = -lpthread -lm -lgfortran $(PLASMA_LIB)
FONTES = example_dgesv.c
EXEC = example_dgesv.exe
OBJETOS = $(FONTES:.c=.o)

libfoo.so:example_dgesv.o
   gcc -I/home/gradvohl/plasma/plasma-installer_2.4.1/build/CBLAS/include -shared -I${INCLUDE} -L${INCLUDE_LIBS} -lpython2.7 -Wl,-undefined,dynamic_lookup,-soname,libfoo.so lapacke_dlarnv_work.o lapacke_dlange_work.o lapacke_dlamch_work.o global.o example_dgesv.o lapacke_dge_trans.o dlarnv.o control.o auxiliary.o plasmaos.o context.o quark.o quarkos.o icl_hash.o icl_list.o cblas_globals.o cblas_dgemm.o dgesv_incpiv.o pdtrsmpl.o pdtile.o pdgetrf_incpiv.o pdtrsm.o allocate.o descriptor.o async.o dgecfi.o pdpack.o dgecfi2.o pdgetmi2.o core_alloc.o core_dlacpy.o core_dgessm.o core_dgetrip.o lapacke_dlacpy_work.o dlacpy.o core_dtstrf.o cblas_dscal.o core_dtrsm.o core_dssssm.o core_dswpab.o lapacke_dlaswp_work.o core_dgetrf_incpiv.o core_dgemm.o cblas_dcopy.o -o libfoo.so
   @ echo -e "Compilacao parcial concluida!\n"   

example_dgesv.o: example_dgesv.c
   gcc ${INCLUDE} -c -fPIC example_dgesv.c -o example_dgesv.o

clean:
   rm *.o


The error I'm getting is this:

Code: Select all
Traceback (most recent call last):
  File "LUplasma.py", line 12, in <module>
    lib = ctypes.CDLL('/home/mbm/Testes/Work/libfoo.so',mode=ctypes.RTLD_GLOBAL)
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 360, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/mbm/Testes/Work/libfoo.so: undefined symbol: F77_dscal


Early, I was getting the same error, but it wasn't "undefined symbol: F77_dscal". The error was "undefined symbol: plasma_lapack_constants". Can anyone help me, please?

Thanks for everything!
Bernardelli
 
Posts: 1
Joined: Wed Jul 31, 2013 9:13 am

Re: Problem - Extending Python with Plasma

Postby mateo70 » Wed Aug 07, 2013 6:37 am

You probably should try a different approach. By doing it your way, you will always miss some files.
You should add a rule to the makefiles to create shared version of each libraries: coreblas, quark and plasma since the plasma_lapack_constants is a symbol defined in coreblas library and F77_dscal is one defined in cblas library.

Mathieu
mateo70
 
Posts: 95
Joined: Fri May 07, 2010 3:48 pm


Return to User discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron