Scalapack install error for code aster
Hello,
I am trying to compile scalapack for installing parallel code aster version as given here https://hitoricae.com/2020/10/31/code_aster-14-6-parallel-version-with-petsc/ .The problem is scalapack_installer does not work. It says unable to connect to netlib.org.
So, I try to compile scalapack from source.
I have already installed openblas-0.3.15.
When I try to run scalapack Slmake.inc with make USE_OPENMP =1 NO_AFFINITY=1
It fails in tests, it says undefined reference to OMP_NUM_THREADS, OMP_IN_PARALLEL etc.
Please help.
Sounds like the tests do not find the OpenMP library, perhaps setting LD_LIBRARY_PATH to the location of libgomp.so (or libomp.so if using llvm/clang) will help

HI this is the terminal output at the moment of error:
Warning: Type mismatch in argument ‘work’ at (1); passed REAL(4) to INTEGER(4) [-Wargument-mismatch]
mpif90 -c -O3 psblastst.f
mpif90 -c -O0 slamch.f
mpif90 -c -O3 pblastst.f
mpicc -c -DAdd_ -O3 -I../SRC -o PB_Cabort.o -DTestingPblas ../SRC/PTOOLS/PB_Cabort.c
mpif90 -O3 -o xspblas1tst psblas1tst.o psblastst.o slamch.o pblastst.o PB_Cwarn.o PB_Cabort.o ../../libscalapack.a /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(saxpy.o): in function saxpy_':
axpy.c:(.text+0xa4): undefined reference to omp_get_max_threads'
/usr/bin/ld: axpy.c:(.text+0xb5): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(sscal.o): in function sscal_':
scal.c:(.text+0x59): undefined reference to omp_get_max_threads'
/usr/bin/ld: scal.c:(.text+0x6c): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(sgemv.o): in function sgemv_':
gemv.c:(.text+0x395): undefined reference to omp_get_max_threads'
/usr/bin/ld: gemv.c:(.text+0x3bd): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(sger.o): in function sger_':
ger.c:(.text+0x1d2): undefined reference to omp_get_max_threads'
/usr/bin/ld: ger.c:(.text+0x1f8): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(strmv.o): in function strmv_':
trmv.c:(.text+0x123): undefined reference to omp_get_max_threads'
/usr/bin/ld: trmv.c:(.text+0x14e): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(ssymv.o): in function ssymv_':
symv.c:(.text+0x165): undefined reference to omp_get_max_threads'
/usr/bin/ld: symv.c:(.text+0x197): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(ssyr.o): in function ssyr_':
syr.c:(.text+0xe9): undefined reference to omp_get_max_threads'
/usr/bin/ld: syr.c:(.text+0x110): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(ssyr2.o): in function ssyr2_':
syr2.c:(.text+0x120): undefined reference to omp_get_max_threads'
/usr/bin/ld: syr2.c:(.text+0x15b): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(sgemm.o): in function sgemm_':
gemm.c:(.text+0x301): undefined reference to omp_get_max_threads'
/usr/bin/ld: gemm.c:(.text+0x312): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(ssymm.o): in function ssymm_':
symm.c:(.text+0x1e3): undefined reference to omp_get_max_threads'
/usr/bin/ld: symm.c:(.text+0x1f4): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(strmm.o): in function strmm_':
trsm.c:(.text+0x2c9): undefined reference to omp_get_max_threads'
/usr/bin/ld: trsm.c:(.text+0x2db): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(strsm.o): in function strsm_':
trsm.c:(.text+0x2c9): undefined reference to omp_get_max_threads'
/usr/bin/ld: trsm.c:(.text+0x2db): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(ssyrk.o): in function ssyrk_':
syrk.c:(.text+0x17b): undefined reference to omp_get_max_threads'
/usr/bin/ld: syrk.c:(.text+0x188): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(ssyr2k.o): in function ssyr2k_':
syr2k.c:(.text+0x1b1): undefined reference to omp_get_max_threads'
/usr/bin/ld: syr2k.c:(.text+0x1cd): undefined reference to omp_in_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(blas_server.o): in function exec_blas._omp_fn.0':
blas_server_omp.c:(.text+0xc6): undefined reference to omp_get_num_threads'
/usr/bin/ld: blas_server_omp.c:(.text+0xcd): undefined reference to omp_get_thread_num'
/usr/bin/ld: blas_server_omp.c:(.text+0x221): undefined reference to omp_get_thread_num'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(blas_server.o): in function goto_set_num_threads':
blas_server_omp.c:(.text+0x401): undefined reference to omp_set_num_threads'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(blas_server.o): in function exec_blas':
blas_server_omp.c:(.text+0x513): undefined reference to GOMP_parallel'
/usr/bin/ld: /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a(sasum_k.o): in function sasum_k':
sasum.c:(.text+0x2ca): undefined reference to omp_get_max_threads'
/usr/bin/ld: sasum.c:(.text+0x2db): undefined reference to `omp_in_parallel'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:90: xspblas1tst] Error 1
make[1]: Leaving directory '/home/anirudh/Desktop/extracts/for_Aster/scalapack/scalapack-2.1.0/PBLAS/TESTING'
make: *** [Makefile:77: pblasexe] Error 2
I used this command: make clean; make lapacklib=/home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a mpicc=mpicc mpif90=mpif90 mpiincdir=/usr/lib/x86_64-linux-gnu/openmpi/include ldflags_c=-fopenmp ldflags_fc=-fopenmp prefix=/home/anirudh/aster_libs/scalapack; make LDFLAGS="-fopenmp"
try adding -lgomp to your lapacklib line - but it may be better to use an OpenBLAS that was not built with USE_OPENMP=1, if scalapack itself is MPI-only
Hi, Thanks for prompt reply. I don't understand how to add -lgomp as you told. This is my make file below: ############################################################################
Program: ScaLAPACK
Module: SLmake.inc
Purpose: Top-level Definitions
Creation date: February 15, 2000
Modified: October 13, 2011
Send bug reports, comments or suggestions to [email protected]
############################################################################
C preprocessor definitions: set CDEFS to one of the following:
-DNoChange (fortran subprogram names are lower case without any suffix)
-DUpCase (fortran subprogram names are upper case without any suffix)
-DAdd_ (fortran subprogram names are lower case with "_" appended)
CDEFS = -DAdd_
The fortran and C compilers, loaders, and their flags
FC = mpif90 CC = mpicc NOOPT = -O0 FCFLAGS = -O3 CCFLAGS = -O3 FCLOADER = $(FC) CCLOADER = $(CC) FCLOADFLAGS = $(FCFLAGS) CCLOADFLAGS = $(CCFLAGS)
The archiver and the flag(s) to use when building archive (library)
Also the ranlib routine. If your system has no ranlib, set RANLIB = echo
ARCH = ar ARCHFLAGS = cr RANLIB = ranlib
The name of the ScaLAPACK library to be created
SCALAPACKLIB = libscalapack.a
BLAS, LAPACK (and possibly other) libraries needed for linking test programs
BLASLIB = /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a LAPACKLIB = /home/anirudh/aster_libs/OpenBLAS/lib/libopenblas.a LIBS = $(LAPACKLIB) $(BLASLIB)
Please could you modify it or change the command above.
Though OpenBLAS was built successfully, it said at the end that I should use OMP_NUM_THREADS since I used USE_OPENMP=1
I tried setting environment variable in linuxlike this as indicated in README.md from OpenBLAS installation(attached pic):
export OMP_NUM_THREADS=12
It also suggests to use two void functions.:
void goto_set_num_threads(int num_threads);
void openblas_set_num_threads(int num_threads);
I don't understand how to use them. I checked in cblas.h and common.h in OpeBLAS directory and they both are declared there.
Please help.

Thanks and Regards Anirudh Nehra
Hi,
My MPI installation is definitely under /usr/lib/x86_64-linux-gnu/openmpi/ as in this picture

LIBS = $(LAPACKLIB $(BLASLIB) -lgomp
(and the openblas_set_num_threads function is only mentioned for using in yiur own C code, as an alternative to setting the environment variable)
Hi,
Thanks for the editing. I think it worked and did not give an error. But I don't see any filles in prefix location. Both Include and Bin folders are empty. To install I tried make install but it does not work.

Please help. Thanks again. Anirudh
Seems it does not have a make install option, and you just need to copy the library. Perhaps it is supposed to be built with cmake nowadays, but this is really a question for Reference-Scalapack https://github.com/Reference-ScaLAPACK/scalapack
Hi, Yes you are right. I got libscalapack.a in the same folder as scalapack-2.0.1. I copied it to required location under bin. I have one more query: When I type echo $LD_LIBRARY_PATH it doesn't show anything in terminal. This means my LD_LIBRARY_PATH variable is not set. How can I set it permanently so every time bash is able to use it.
Thank you for your help.
Regards Anirudh
set it in your .profile or .bashrc