Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions source/module_hsolver/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ remove_definitions(-DUSE_PAW)
remove_definitions(-D__EXX)

if (ENABLE_MPI)
AddTest(
TARGET hsolver_parak2d_test
LIBS parameter ${math_libs} base device MPI::MPI_CXX
SOURCES parallel_k2d_test.cpp ../parallel_k2d.cpp ../../module_cell/parallel_kpoints.cpp ../../module_basis/module_ao/parallel_2d.cpp
)
AddTest(
TARGET HSolver_bpcg
LIBS parameter ${math_libs} base psi device container
Expand Down Expand Up @@ -147,11 +152,7 @@ install(FILES PEXSI-DM-GammaOnly-Si2.dat DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
install(FILES diago_pexsi_parallel_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
install(FILES parallel_k2d_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

AddTest(
TARGET hsolver_parak2d_test
LIBS parameter ${math_libs} base device MPI::MPI_CXX
SOURCES parallel_k2d_test.cpp ../parallel_k2d.cpp ../../module_cell/parallel_kpoints.cpp ../../module_basis/module_ao/parallel_2d.cpp
)


find_program(BASH bash)
if (ENABLE_MPI)
Expand Down
10 changes: 6 additions & 4 deletions source/module_hsolver/test/diago_lapack_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Author: Zhang Xiaoyang
// A modified version of diago_lcao_test.cpp
#define private public
// #define private public
#include "module_parameter/parameter.h"
#undef private
// #undef private
// Remove some useless functions and dependencies. Serialized the full code
// and refactored some function.

Expand Down Expand Up @@ -187,8 +187,10 @@ class DiagoLapackPrepare

void set_env()
{
PARAM.sys.nlocal = nlocal;
PARAM.input.nbands = nbands;
// PARAM.sys.nlocal = nlocal;
PARAM.set_sys_nlocal(nlocal);
// PARAM.input.nbands = nbands;
PARAM.set_input_nbands(nbands);
}

void diago()
Expand Down
6 changes: 6 additions & 0 deletions source/module_lr/AX/test/AX_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <gtest/gtest.h>
#ifdef __MPI
#include "mpi.h"
#endif
#include "../AX.h"

#include "module_lr/utils/lr_util.h"
Expand Down Expand Up @@ -206,9 +208,13 @@ TEST_F(AXTest, ComplexParallel)
int main(int argc, char** argv)
{
srand(time(nullptr)); // for random number generator
#ifdef __MPI
MPI_Init(&argc, &argv);
#endif
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
#ifdef __MPI
MPI_Finalize();
#endif
return result;
}
7 changes: 6 additions & 1 deletion source/module_lr/dm_trans/test/dm_trans_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <gtest/gtest.h>
#include "mpi.h"
#include <fstream>
#include "../dm_trans.h"
#ifdef __MPI
#include "mpi.h"
#include "module_lr/utils/lr_util.h"
#endif
struct matsize
Expand Down Expand Up @@ -226,9 +227,13 @@ TEST_F(DMTransTest, ComplexParallel)
int main(int argc, char** argv)
{
srand(time(NULL)); // for random number generator
#ifdef __MPI
MPI_Init(&argc, &argv);
#endif
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
#ifdef __MPI
MPI_Finalize();
#endif
return result;
}
12 changes: 11 additions & 1 deletion source/module_parameter/parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@ void Parameter::set_pal_param(const int& myrank, const int& nproc, const int& nt
void Parameter::set_start_time(const std::time_t& start_time)
{
sys.start_time = start_time;
}
}

void Parameter::set_input_nbands(const int& nbands)
{
input.nbands = nbands;
}

void Parameter::set_sys_nlocal(const int& nlocal)
{
sys.nlocal = nlocal;
}
5 changes: 5 additions & 0 deletions source/module_parameter/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class Parameter
// Set the start time
void set_start_time(const std::time_t& start_time);

// set input.nbands
void set_input_nbands(const int& nbands);
// set sys.nlocal
void set_sys_nlocal(const int& nlocal);

private:
// Only ReadInput and CalAtomInfo can modify the value of Parameter.
// Do not add extra friend class here!!!
Expand Down
Loading