sddspseudoinverse path to lapack and blas libs

Moderators: cyao, soliday

Post Reply
blanco-garcia
Posts: 68
Joined: 29 Oct 2021, 10:41

sddspseudoinverse path to lapack and blas libs

Post by blanco-garcia » 08 Mar 2023, 05:22

Dear all,

I am compiling elegant in a server with a non-standard installation of libraries. I have added the path to lapack using OPT_CFLAGS and OPT_CXXFLAGS in epics/base/configure/CONFIG as follows :

Code: Select all

#orblancog: inserting my vars
CROSS_COMPILER_TARGET_ARCHS=
SHARED_LIBRARIES=NO
OPT_CFLAGS_YES += -I/ccc/products/lapack-3.9.1/gcc--11.1.0/default/include -I/ccc/products/boost-1.74.0/gcc--11.1.0__openmpi--4.0.1/default/include
OPT_CXXFLAGS_YES += -I/ccc/products/lapack-3.9.1/gcc--11.1.0/default/include -I/ccc/products/boost-1.74.0/gcc--11.1.0__openmpi--4.0.1/default/include
#orblancog: end of editing
However, these variables are not seen when compiling sddspseudoinverse. Is there another variable that should be used for it ?

Code: Select all

/usr/bin/g++ -o sddspseudoinverse  -L/ccc/work/cont003/soleil/blancoor/public/progs/elegant.2023.1.0/elegant_compilation/epics/extensions/lib/linux-x86_64 -Wl,-rpath,/ccc/work/cont003/soleil/blancoor/public/progs/elegant.2023.1.0/elegant_compilation/epics/extensions/lib/linux-x86_64     -fopenmp       -rdynamic -m64         sddspseudoinverse.o    -lmdbcommon -lSDDS1 -lmdbmth -lmdblib -lmeschach -llzma  -llapack -lblas -lz -lpthread   -lreadline -lm -lrt -ldl -lgcc
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status

Best regards,
o

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: sddspseudoinverse path to lapack and blas libs

Post by soliday » 08 Mar 2023, 09:45

You will have to edit the epics/extensions/src/SDDS/SDDSaps/pseudoInverse/Makefile

Change:

Code: Select all

ifneq ($(LAPACK), 0)
 USR_LDFLAGS_Linux += -fopenmp
 USR_CFLAGS_Linux += -fopenmp
 sddspseudoinverse_CFLAGS += -DLAPACK -I/usr/include/lapacke
 sddspseudoinverse_SYS_LIBS += lapack blas
 matrix_CFLAGS += -DLAPACK -I/usr/include/lapacke
 sddsmatrixop_CFLAGS += -DLAPACK 
 sddsmatrixop_SYS_LIBS += lapack blas
 sdds2dpfit_CFLAGS += -DLAPACK 
 sdds2dpfit_SYS_LIBS += lapack blas
 sddsica_CFLAGS += -DLAPACK -I/usr/include/lapacke
 sddsica_SYS_LIBS += lapack blas	
else
to

Code: Select all

ifneq ($(LAPACK), 0)
 USR_LDFLAGS_Linux += -fopenmp
 USR_CFLAGS_Linux += -fopenmp
 sddspseudoinverse_CFLAGS += -DLAPACK -I/ccc/products/lapack-3.9.1/gcc--11.1.0/default/include 
 sddspseudoinverse_CFLAGS += -I/ccc/products/boost-1.74.0/gcc--11.1.0__openmpi--4.0.1/default/include
 sddspseudoinverse_LIBS_Linux += lapack blas
 matrix_CFLAGS += -DLAPACK -I/ccc/products/lapack-3.9.1/gcc--11.1.0/default/include 
 matrix_CFLAGS += -I/ccc/products/boost-1.74.0/gcc--11.1.0__openmpi--4.0.1/default/include
 sddsmatrixop_CFLAGS += -DLAPACK 
 sddsmatrixop_LIBS_Linux += lapack blas
 sdds2dpfit_CFLAGS += -DLAPACK 
 sdds2dpfit_SYS_LIBS += lapack blas
 sddsica_CFLAGS += -DLAPACK -I/ccc/products/lapack-3.9.1/gcc--11.1.0/default/include 
 sddsica_CFLAGS += -I/ccc/products/boost-1.74.0/gcc--11.1.0__openmpi--4.0.1/default/include
 sddsica_LIBS_Linux += lapack blas	
else

blanco-garcia
Posts: 68
Joined: 29 Oct 2021, 10:41

Re: sddspseudoinverse path to lapack and blas libs

Post by blanco-garcia » 09 Mar 2023, 09:16

Dear Soliday, thank you.

The compilation moved a little bit forward. Now I'm getting this error :

Code: Select all

make[2]: *** No rule to make target '../../../../../lib/linux-x86_64/liblapack.a', needed by 'sddspseudoinverse'.  Stop.
make[2]: Leaving directory '/ccc/work/cont003/soleil/blancoor/public/progs/elegant.2023.1.0/elegant_compilation/epics/extensions/src/SDDS/SDDSaps/pseudoInverse/O.linux-x86_64'

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: sddspseudoinverse path to lapack and blas libs

Post by soliday » 09 Mar 2023, 10:23

Try adding:

lapack_DIR=/ccc/products/lapack-3.9.1/gcc--11.1.0/default/lib
blas_DIR=/ccc/products/lapack-3.9.1/gcc--11.1.0/default/lib

blanco-garcia
Posts: 68
Joined: 29 Oct 2021, 10:41

Re: sddspseudoinverse path to lapack and blas libs

Post by blanco-garcia » 09 Mar 2023, 12:08

Thank you,

it went a little bit further, now I see :

Code: Select all

make[2]: *** [../../../../../../base/configure/RULES_BUILD:259: matrix.o] Error 1
make[2]: Leaving directory '/ccc/work/cont003/soleil/blancoor/public/progs/elegant.2023.1.0/elegant_compilation/epics/extensions/src/SDDS/SDDSaps/pseudoInverse/O.linux-x86_64'
[code]

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: sddspseudoinverse path to lapack and blas libs

Post by soliday » 09 Mar 2023, 17:51

I went though the process of building a custom version of lapack and getting it to work with the code in epics/extensions/src/SDDS/SDDSaps/pseudoInverse

Download the updated code at https://ops.aps.anl.gov/downloads/pseudoInverse.tar
Then run "tar -xvf pseudoInverse.tar" to extract the updated Makefile and matrix.c

I added a section in the Makefile where you can set CUSTOM_LAPACK=1 and set the proper directory locations

Then run "make clean all" in this directory.

Post Reply