Skip to content

Commit 42417ad

Browse files
authored
Merge branch 'deepmodeling:develop' into develop
2 parents 902a6a3 + 4a830c3 commit 42417ad

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,52 @@ elseif(NOT USE_SW)
555555
find_package(Lapack REQUIRED)
556556
include_directories(${FFTW3_INCLUDE_DIRS})
557557
list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK BLAS::BLAS)
558-
if(USE_DSP)
559-
target_link_libraries(${ABACUS_BIN_NAME} ${SCALAPACK_LIBRARY_DIR})
558+
if(SCALAPACK_LIBRARY_DIR)
559+
if(IS_DIRECTORY "${SCALAPACK_LIBRARY_DIR}")
560+
find_library(
561+
USER_SCALAPACK_LIBRARY
562+
NAMES scalapack scalapack-openmpi scalapack-mpi scalapack-mpich
563+
HINTS ${SCALAPACK_LIBRARY_DIR}
564+
PATH_SUFFIXES lib lib64
565+
NO_DEFAULT_PATH
566+
)
567+
if(USER_SCALAPACK_LIBRARY)
568+
list(APPEND math_libs ${USER_SCALAPACK_LIBRARY})
569+
else()
570+
find_package(ScaLAPACK QUIET)
571+
if(ScaLAPACK_FOUND)
572+
list(APPEND math_libs ScaLAPACK::ScaLAPACK)
573+
else()
574+
message(
575+
FATAL_ERROR
576+
"SCALAPACK_LIBRARY_DIR is set to '${SCALAPACK_LIBRARY_DIR}', but no compatible ScaLAPACK library was found there and find_package(ScaLAPACK) also failed."
577+
)
578+
endif()
579+
endif()
580+
else()
581+
if(NOT IS_ABSOLUTE "${SCALAPACK_LIBRARY_DIR}")
582+
message(
583+
FATAL_ERROR
584+
"SCALAPACK_LIBRARY_DIR is set to '${SCALAPACK_LIBRARY_DIR}', but this is not an absolute library path. Please provide either a directory containing libscalapack or a full absolute path to the ScaLAPACK library file."
585+
)
586+
elseif(NOT EXISTS "${SCALAPACK_LIBRARY_DIR}")
587+
message(
588+
FATAL_ERROR
589+
"SCALAPACK_LIBRARY_DIR is set to '${SCALAPACK_LIBRARY_DIR}', but this path does not exist. Please provide either a directory containing libscalapack or a full absolute path to the ScaLAPACK library file."
590+
)
591+
elseif(IS_DIRECTORY "${SCALAPACK_LIBRARY_DIR}")
592+
message(
593+
FATAL_ERROR
594+
"SCALAPACK_LIBRARY_DIR is set to '${SCALAPACK_LIBRARY_DIR}', but this value resolved to a directory in the full-library-path branch. Please provide either a directory containing libscalapack or a full absolute path to the ScaLAPACK library file."
595+
)
596+
endif()
597+
list(APPEND math_libs ${SCALAPACK_LIBRARY_DIR})
598+
endif()
599+
elseif(USE_DSP)
600+
message(
601+
FATAL_ERROR
602+
"USE_DSP is enabled, but SCALAPACK_LIBRARY_DIR is not set. Please provide -DSCALAPACK_LIBRARY_DIR=<scalapack dir or full library path>."
603+
)
560604
else()
561605
find_package(ScaLAPACK REQUIRED)
562606
list(APPEND math_libs ScaLAPACK::ScaLAPACK)

source/source_lcao/module_gint/kernel/gemm_nn_vbatch.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static __global__ void vbatched_gemm_nn_kernel(const int* M,
273273
const int* global_ldc,
274274
const T* alpha)
275275
{
276-
extern __shared__ __align__(sizeof(T)) unsigned char smem[];
276+
extern __shared__ __align__(sizeof(double)) unsigned char smem[];
277277
T* shared_mem = reinterpret_cast<T*>(smem);
278278

279279
int batchid = blockIdx.z;

source/source_lcao/module_gint/kernel/gemm_tn_vbatch.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static __global__ void vbatched_gemm_nt_kernel(const int* M,
273273
const int* global_ldc,
274274
const T* alpha)
275275
{
276-
extern __shared__ __align__(sizeof(T)) unsigned char smem[];
276+
extern __shared__ __align__(sizeof(double)) unsigned char smem[];
277277
T* shared_mem = reinterpret_cast<T*>(smem);
278278

279279
int batchid = blockIdx.z;

0 commit comments

Comments
 (0)