Page 1 of 1

sddspseudoinverse path to lapack and blas libs

Posted: 08 Mar 2023, 05:22
by blanco-garcia
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

Re: sddspseudoinverse path to lapack and blas libs

Posted: 08 Mar 2023, 09:45
by soliday
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

Re: sddspseudoinverse path to lapack and blas libs

Posted: 09 Mar 2023, 09:16
by blanco-garcia
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'

Re: sddspseudoinverse path to lapack and blas libs

Posted: 09 Mar 2023, 10:23
by soliday
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

Re: sddspseudoinverse path to lapack and blas libs

Posted: 09 Mar 2023, 12:08
by blanco-garcia
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]

Re: sddspseudoinverse path to lapack and blas libs

Posted: 09 Mar 2023, 17:51
by soliday
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.