Skip to content

Commit 4480e17

Browse files
authored
Merge branch 'develop' into fft14
2 parents 731d7ee + e2d4606 commit 4480e17

File tree

972 files changed

+54623
-16344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

972 files changed

+54623
-16344
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ jobs:
4848
run: |
4949
cmake --build build -j8
5050
cmake --install build
51-
- name: Test
51+
- name: Unit Test
5252
env:
5353
GTEST_COLOR: 'yes'
5454
OMP_NUM_THREADS: '2'
5555
run: |
56-
cmake --build build --target test ARGS="-V --timeout 1700"
56+
cmake --build build --target test ARGS="-V --timeout 1700 -E integrated_test"
57+
- name: Integrated Test
58+
env:
59+
GTEST_COLOR: 'yes'
60+
OMP_NUM_THREADS: '2'
61+
run: |
62+
cmake --build build --target test ARGS="-V --timeout 1700 -R integrated_test"
63+

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,4 +798,4 @@ install(PROGRAMS ${ABACUS_BIN_PATH}
798798

799799
if(ENABLE_COVERAGE)
800800
coverage_evaluate()
801-
endif()
801+
endif()

docs/advanced/input_files/input-main.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,10 +1645,13 @@ These variables are used to control the output of properties.
16451645
### out_dm
16461646

16471647
- **Type**: Boolean
1648-
- **Availability**: Numerical atomic orbital basis (gamma-only algorithm)
1648+
- **Availability**: Numerical atomic orbital basis
16491649
- **Description**: Whether to output the density matrix of localized orbitals into files in the folder `OUT.${suffix}`. The files are named as:
1650-
- nspin = 1: SPIN1_DM;
1651-
- nspin = 2: SPIN1_DM, and SPIN2_DM.
1650+
- For gamma only case:
1651+
- nspin = 1: SPIN1_DM;
1652+
- nspin = 2: SPIN1_DM, and SPIN2_DM.
1653+
- For multi-k points case:
1654+
- SPIN\*_K\*_DM, where \* stands for index of spin and kpoints;
16521655
- **Default**: False
16531656

16541657
### out_dm1

source/Makefile.Objects

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ OBJS_MAIN=main.o\
126126

127127
OBJS_BASE=abfs-vector3_order.o\
128128
assoc_laguerre.o\
129-
blas_connector.o\
129+
blas_connector_base.o\
130+
blas_connector_vector.o\
131+
blas_connector_matrix.o\
130132
complexarray.o\
131133
complexmatrix.o\
132134
clebsch_gordan_coeff.o\

source/module_base/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ add_library(
1010
base
1111
OBJECT
1212
assoc_laguerre.cpp
13-
blas_connector.cpp
13+
blas_connector_base.cpp
14+
blas_connector_vector.cpp
15+
blas_connector_matrix.cpp
1416
clebsch_gordan_coeff.cpp
1517
complexarray.cpp
1618
complexmatrix.cpp

source/module_base/blas_connector.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,26 @@ class BlasConnector
368368

369369
#ifdef __CUDA
370370

371+
#include <cuda_runtime.h>
372+
#include "cublas_v2.h"
373+
374+
// If you want to use cublas, you need these functions to create and destroy the cublas/hipblas handle.
375+
// You also need to use these functions to translate the transpose parameter into cublas/hipblas datatype.
376+
371377
namespace BlasUtils{
372-
void createGpuBlasHandle();
373-
void destoryBLAShandle();
378+
379+
static cublasHandle_t cublas_handle = nullptr;
380+
381+
void createGpuBlasHandle(); // Create a cublas/hipblas handle.
382+
383+
void destoryBLAShandle(); // Destroy the cublas/hipblas handle. Do this when the software is about to end.
384+
385+
cublasOperation_t judge_trans(bool is_complex, const char& trans, const char* name); // Translate a normal transpose parameter to a cublas/hipblas type.
386+
387+
cublasSideMode_t judge_side(const char& trans); // Translate a normal side parameter to a cublas/hipblas type.
388+
389+
cublasFillMode_t judge_fill(const char& trans); // Translate a normal fill parameter to a cublas/hipblas type.
390+
374391
}
375392

376393
#endif
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#include "blas_connector.h"
2+
#include "macros.h"
3+
4+
#ifdef __CUDA
5+
#include <base/macros/macros.h>
6+
#include <cuda_runtime.h>
7+
#include "cublas_v2.h"
8+
#include "module_base/kernels/math_kernel_op.h"
9+
#include "module_base/module_device/memory_op.h"
10+
11+
12+
namespace BlasUtils{
13+
14+
void createGpuBlasHandle(){
15+
if (cublas_handle == nullptr) {
16+
cublasErrcheck(cublasCreate(&cublas_handle));
17+
}
18+
}
19+
20+
void destoryBLAShandle(){
21+
if (cublas_handle != nullptr) {
22+
cublasErrcheck(cublasDestroy(cublas_handle));
23+
cublas_handle = nullptr;
24+
}
25+
}
26+
27+
28+
cublasOperation_t judge_trans(bool is_complex, const char& trans, const char* name)
29+
{
30+
if (trans == 'N')
31+
{
32+
return CUBLAS_OP_N;
33+
}
34+
else if(trans == 'T')
35+
{
36+
return CUBLAS_OP_T;
37+
}
38+
else if(is_complex && trans == 'C')
39+
{
40+
return CUBLAS_OP_C;
41+
}
42+
return CUBLAS_OP_N;
43+
}
44+
45+
cublasSideMode_t judge_side(const char& trans)
46+
{
47+
if (trans == 'L')
48+
{
49+
return CUBLAS_SIDE_LEFT;
50+
}
51+
else if (trans == 'R')
52+
{
53+
return CUBLAS_SIDE_RIGHT;
54+
}
55+
return CUBLAS_SIDE_LEFT;
56+
}
57+
58+
cublasFillMode_t judge_fill(const char& trans)
59+
{
60+
if (trans == 'F')
61+
{
62+
return CUBLAS_FILL_MODE_FULL;
63+
}
64+
else if (trans == 'U')
65+
{
66+
return CUBLAS_FILL_MODE_UPPER;
67+
}
68+
else if (trans == 'D')
69+
{
70+
return CUBLAS_FILL_MODE_LOWER;
71+
}
72+
return CUBLAS_FILL_MODE_FULL;
73+
}
74+
75+
} // namespace BlasUtils
76+
77+
#endif

0 commit comments

Comments
 (0)