Skip to content

Commit 4eb3334

Browse files
committed
Fix dsp linking order to put ScaLapack after Openblas
1 parent 9a3fb68 commit 4eb3334

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎source/CMakeLists.txt‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ elseif(USE_SW)
176176
${SW_MATH}/libswblas.a
177177
gfortran)
178178
else()
179-
if(ENABLE_MPI)
179+
# The DSP ScaLAPACK bundles BLAS objects built without OpenMP support.
180+
# The linker resolves BLAS symbols from the first library that provides
181+
# them, so the standalone BLAS must precede ScaLAPACK on the link line;
182+
# otherwise the bundled non-OpenMP BLAS wins and OpenBLAS aborts with
183+
# "Detect OpenMP Loop" once ABACUS calls it from an OpenMP region.
184+
if(ENABLE_MPI AND NOT USE_DSP)
180185
list(APPEND _abacus_linalg_libs ScaLAPACK::ScaLAPACK)
181186
endif()
182187
if(ENABLE_OPENMP)
@@ -186,6 +191,9 @@ else()
186191
FFTW3::FFTW3
187192
LAPACK::LAPACK
188193
BLAS::BLAS)
194+
if(ENABLE_MPI AND USE_DSP)
195+
list(APPEND _abacus_linalg_libs ScaLAPACK::ScaLAPACK)
196+
endif()
189197
list(APPEND _abacus_linalg_include_dirs ${FFTW3_INCLUDE_DIRS})
190198
if(ENABLE_FLOAT_FFTW)
191199
list(APPEND _abacus_linalg_libs FFTW3::FFTW3_FLOAT)

0 commit comments

Comments
 (0)