Skip to content

Commit 0bbc44f

Browse files
authored
Merge branch 'deepmodeling:develop' into ucell15
2 parents 58f3353 + ccd2874 commit 0bbc44f

File tree

150 files changed

+2442
-3259
lines changed

Some content is hidden

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

150 files changed

+2442
-3259
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ option(ENABLE_CNPY "Enable cnpy usage." OFF)
4040
option(ENABLE_PEXSI "Enable support for PEXSI." OFF)
4141
option(ENABLE_CUSOLVERMP "Enable cusolvermp." OFF)
4242
option(USE_DSP "Enable DSP usage." OFF)
43+
option(USE_CUDA_ON_DCU "Enable CUDA on DCU" OFF)
4344

4445
# enable json support
4546
if(ENABLE_RAPIDJSON)
@@ -126,6 +127,10 @@ if (USE_DSP)
126127
set(ABACUS_BIN_NAME abacus_dsp)
127128
endif()
128129

130+
if (USE_CUDA_ON_DCU)
131+
add_compile_definitions(__CUDA_ON_DCU)
132+
endif()
133+
129134
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
130135

131136
if(ENABLE_COVERAGE)

source/Makefile.Objects

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,11 @@ OBJS_DEEPKS=LCAO_deepks.o\
201201
deepks_hmat.o\
202202
LCAO_deepks_interface.o\
203203
orbital_precalc.o\
204-
orbital_precalc_k.o\
205204
cal_gdmx.o\
206-
cal_gdmx_k.o\
207205
cal_gedm.o\
208206
cal_gvx.o\
209207
cal_descriptor.o\
210208
v_delta_precalc.o\
211-
v_delta_precalc_k.o\
212209

213210

214211
OBJS_ELECSTAT=elecstate.o\

source/module_base/module_device/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void record_device_memory(const Device* dev, std::ofstream& ofs_device, std::str
8686
* @brief for compatibility with __CUDA_ARCH__ 600 and earlier
8787
*
8888
*/
89-
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 600
89+
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 600 && !defined(__CUDA_ON_DCU)
9090
static __inline__ __device__ double atomicAdd(double* address, double val)
9191
{
9292
unsigned long long int* address_as_ull = (unsigned long long int*)address;

source/module_base/tool_title.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void TITLE(const std::string &class_name,const std::string &function_name,const
1919
{
2020
if (disable)
2121
{
22-
return;//no output
22+
return; // no output
2323
}
2424
#ifdef __NORMAL
2525
std::cout<<" ==> "<<class_name<<"::"<<function_name<<"\t"
@@ -39,7 +39,7 @@ void TITLE(std::ofstream &ofs,const std::string &class_name,const std::string &f
3939
{
4040
if (disable)
4141
{
42-
return;//no output
42+
return; // no output
4343
}
4444
#ifdef __NORMAL
4545
std::cout<<"\n\n ==> "<<class_name<<"::"<<function_name<<"\t"

source/module_cell/atom_spec.cpp

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -102,51 +102,54 @@ void Atom::bcast_atom(void)
102102
Parallel_Common::bcast_bool(this->flag_empty_element);
103103
Parallel_Common::bcast_double(mass);
104104

105-
if (GlobalV::MY_RANK != 0)
105+
if (na > 0)
106106
{
107-
assert(na != 0);
108-
this->tau.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
109-
this->dis.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
110-
this->taud.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
111-
this->vel.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
112-
this->mag.resize(na, 0);
113-
this->angle1.resize(na, 0);
114-
this->angle2.resize(na, 0);
115-
this->m_loc_.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
116-
this->mbl.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
117-
this->lambda.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
118-
this->constrain.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
119-
}
107+
if (GlobalV::MY_RANK != 0)
108+
{
109+
assert(na != 0);
110+
this->tau.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
111+
this->dis.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
112+
this->taud.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
113+
this->vel.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
114+
this->mag.resize(na, 0);
115+
this->angle1.resize(na, 0);
116+
this->angle2.resize(na, 0);
117+
this->m_loc_.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
118+
this->mbl.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
119+
this->lambda.resize(na, ModuleBase::Vector3<double>(0, 0, 0));
120+
this->constrain.resize(na, ModuleBase::Vector3<int>(0, 0, 0));
121+
}
120122

121-
for (int i = 0; i < na; i++)
122-
{
123-
Parallel_Common::bcast_double(tau[i].x);
124-
Parallel_Common::bcast_double(tau[i].y);
125-
Parallel_Common::bcast_double(tau[i].z);
126-
Parallel_Common::bcast_double(taud[i].x);
127-
Parallel_Common::bcast_double(taud[i].y);
128-
Parallel_Common::bcast_double(taud[i].z);
129-
Parallel_Common::bcast_double(dis[i].x);
130-
Parallel_Common::bcast_double(dis[i].y);
131-
Parallel_Common::bcast_double(dis[i].z);
132-
Parallel_Common::bcast_double(vel[i].x);
133-
Parallel_Common::bcast_double(vel[i].y);
134-
Parallel_Common::bcast_double(vel[i].z);
135-
Parallel_Common::bcast_double(mag[i]);
136-
Parallel_Common::bcast_double(angle1[i]);
137-
Parallel_Common::bcast_double(angle2[i]);
138-
Parallel_Common::bcast_double(m_loc_[i].x);
139-
Parallel_Common::bcast_double(m_loc_[i].y);
140-
Parallel_Common::bcast_double(m_loc_[i].z);
141-
Parallel_Common::bcast_int(mbl[i].x);
142-
Parallel_Common::bcast_int(mbl[i].y);
143-
Parallel_Common::bcast_int(mbl[i].z);
144-
Parallel_Common::bcast_double(lambda[i].x);
145-
Parallel_Common::bcast_double(lambda[i].y);
146-
Parallel_Common::bcast_double(lambda[i].z);
147-
Parallel_Common::bcast_int(constrain[i].x);
148-
Parallel_Common::bcast_int(constrain[i].y);
149-
Parallel_Common::bcast_int(constrain[i].z);
123+
for (int i = 0; i < na; i++)
124+
{
125+
Parallel_Common::bcast_double(tau[i].x);
126+
Parallel_Common::bcast_double(tau[i].y);
127+
Parallel_Common::bcast_double(tau[i].z);
128+
Parallel_Common::bcast_double(taud[i].x);
129+
Parallel_Common::bcast_double(taud[i].y);
130+
Parallel_Common::bcast_double(taud[i].z);
131+
Parallel_Common::bcast_double(dis[i].x);
132+
Parallel_Common::bcast_double(dis[i].y);
133+
Parallel_Common::bcast_double(dis[i].z);
134+
Parallel_Common::bcast_double(vel[i].x);
135+
Parallel_Common::bcast_double(vel[i].y);
136+
Parallel_Common::bcast_double(vel[i].z);
137+
Parallel_Common::bcast_double(mag[i]);
138+
Parallel_Common::bcast_double(angle1[i]);
139+
Parallel_Common::bcast_double(angle2[i]);
140+
Parallel_Common::bcast_double(m_loc_[i].x);
141+
Parallel_Common::bcast_double(m_loc_[i].y);
142+
Parallel_Common::bcast_double(m_loc_[i].z);
143+
Parallel_Common::bcast_int(mbl[i].x);
144+
Parallel_Common::bcast_int(mbl[i].y);
145+
Parallel_Common::bcast_int(mbl[i].z);
146+
Parallel_Common::bcast_double(lambda[i].x);
147+
Parallel_Common::bcast_double(lambda[i].y);
148+
Parallel_Common::bcast_double(lambda[i].z);
149+
Parallel_Common::bcast_int(constrain[i].x);
150+
Parallel_Common::bcast_int(constrain[i].y);
151+
Parallel_Common::bcast_int(constrain[i].z);
152+
}
150153
}
151154

152155
return;

source/module_cell/module_neighbor/sltk_atom_arrange.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -162,30 +162,4 @@ void atom_arrange::search(
162162
}
163163

164164
return;
165-
}
166-
167-
168-
//2015-05-07
169-
void atom_arrange::delete_vector(
170-
std::ofstream &ofs_in,
171-
const bool pbc_flag, // GlobalV::SEARCH_PBC
172-
Grid_Driver &grid_d,
173-
const UnitCell &ucell,
174-
const double &search_radius_bohr,
175-
const int &test_atom_in)
176-
{
177-
const double radius_lat0unit2 = search_radius_bohr / ucell.lat0;
178-
179-
Atom_input at2(
180-
ofs_in,
181-
ucell,
182-
ucell.nat,
183-
ucell.ntype,
184-
pbc_flag,
185-
radius_lat0unit2,
186-
test_atom_in);
187-
188-
grid_d.delete_vector(at2.getGrid_layerX_minus(),at2.getGrid_layerY_minus(),at2.getGrid_layerZ_minus());
189-
190-
grid_d.delete_Cell();
191-
}
165+
}

source/module_cell/module_neighbor/sltk_atom_arrange.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ class atom_arrange
3030
const double& rcutmax_Beta,
3131
const bool gamma_only_local);
3232

33-
//2015-05-07
34-
static void delete_vector(
35-
std::ofstream &ofs_in,
36-
const bool pbc_flag,
37-
Grid_Driver &grid_d,
38-
const UnitCell &ucell,
39-
const double &search_radius_bohr,
40-
const int &test_atom_in);
41-
42-
private:
43-
4433
};
4534

4635
#endif

source/module_cell/module_neighbor/sltk_grid.cpp

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,9 @@ CellSet::CellSet()
1616
in_grid[2] = 0;
1717
}
1818

19-
Grid::Grid(const int& test_grid_in) : test_grid(test_grid_in)
20-
{
21-
// ModuleBase::TITLE("Grid","Grid");
22-
//----------------------------------------------------------
23-
// EXPLAIN : init_cell_flag (use this flag in case memory
24-
// leak)
25-
//----------------------------------------------------------
26-
init_cell_flag = false;
27-
}
19+
Grid::Grid(const int& test_grid_in) : test_grid(test_grid_in) {}
2820

29-
Grid::~Grid()
30-
{
31-
this->delete_Cell();
32-
}
21+
Grid::~Grid() {}
3322

3423
void Grid::init(std::ofstream& ofs_in, const UnitCell& ucell, const Atom_input& input)
3524
{
@@ -49,7 +38,6 @@ void Grid::setMemberVariables(std::ofstream& ofs_in, // output data to ofs
4938
{
5039
ModuleBase::TITLE("SLTK_Grid", "setMemberVariables");
5140

52-
this->delete_Cell();
5341
// mohan add 2010-09-05
5442
// AdjacentSet::call_times = 0;
5543

@@ -96,8 +84,6 @@ void Grid::setMemberVariables(std::ofstream& ofs_in, // output data to ofs
9684
Cell[i][j].resize(cell_nz);
9785
}
9886
}
99-
this->init_cell_flag = true;
100-
10187
this->true_cell_x = input.getGrid_layerX_minus();
10288
this->true_cell_y = input.getGrid_layerY_minus();
10389
this->true_cell_z = input.getGrid_layerZ_minus();
@@ -508,14 +494,3 @@ void Grid::Construct_Adjacent_final(const int i,
508494
fatom1.addAdjacent(fatom2);
509495
}
510496
}
511-
// 2015-05-07
512-
void Grid::delete_vector(int i, int j, int k)
513-
{
514-
if (expand_flag)
515-
{
516-
if (this->pbc)
517-
{
518-
this->Cell[i][j][k].atom_map.clear();
519-
}
520-
}
521-
}

source/module_cell/module_neighbor/sltk_grid.h

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ class Grid
4141
Grid(const int& test_grid_in);
4242
virtual ~Grid();
4343

44-
void init(std::ofstream& ofs, const UnitCell& ucell, const Atom_input& input);
44+
Grid& operator=(Grid&&) = default;
4545

46-
// 2015-05-07
47-
void delete_vector(int i, int j, int k);
46+
void init(std::ofstream& ofs, const UnitCell& ucell, const Atom_input& input);
4847

4948
// Data
5049
bool pbc; // periodic boundary condition
@@ -64,28 +63,7 @@ class Grid
6463
int true_cell_z;
6564

6665
std::vector<std::vector<std::vector<CellSet>>> Cell; // dx , dy ,dz is cell number in each direction,respectly.
67-
void delete_Cell() // it will replace by container soon!
68-
{
69-
if (this->init_cell_flag)
70-
{
71-
for (int i = 0; i < this->cell_nx; i++)
72-
{
73-
for (int j = 0; j < this->cell_ny; j++)
74-
{
75-
this->Cell[i][j].clear();
76-
}
77-
}
78-
79-
for (int i = 0; i < this->cell_nx; i++)
80-
{
81-
this->Cell[i].clear();
82-
}
83-
84-
this->Cell.clear();
85-
this->init_cell_flag = false;
86-
}
87-
}
88-
bool init_cell_flag = false;
66+
8967
// LiuXh add 2019-07-15
9068
double getD_minX() const
9169
{
@@ -125,8 +103,8 @@ class Grid
125103
return true_cell_z;
126104
}
127105

128-
private:
129-
const int test_grid;
106+
private:
107+
int test_grid = 0;
130108
//==========================================================
131109
// MEMBER FUNCTIONS :
132110
// Three Main Steps:

source/module_cell/module_neighbor/sltk_grid_driver.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
#include <omp.h>
99
#endif
1010

11-
namespace GlobalC
12-
{
13-
Grid_Driver GridD;
14-
}
1511
Grid_Driver::Grid_Driver(
1612
const int &test_d_in,
1713
const int &test_grid_in)
@@ -25,13 +21,11 @@ Grid_Driver::~Grid_Driver()
2521
{
2622
}
2723

28-
29-
void Grid_Driver::Find_atom(
30-
const UnitCell &ucell,
31-
const ModuleBase::Vector3<double> &cartesian_pos,
32-
const int &ntype,
33-
const int &nnumber,
34-
AdjacentAtomInfo *adjs)
24+
void Grid_Driver::Find_atom(const UnitCell& ucell,
25+
const ModuleBase::Vector3<double>& cartesian_pos,
26+
const int& ntype,
27+
const int& nnumber,
28+
AdjacentAtomInfo* adjs) const
3529
{
3630
ModuleBase::timer::tick("Grid_Driver","Find_atom");
3731
// std::cout << "lenght in Find atom = " << atomlink[offset].fatom.getAdjacentSet()->getLength() << std::endl;

0 commit comments

Comments
 (0)