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
7 changes: 7 additions & 0 deletions source/module_basis/module_ao/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ AddTest(
LIBS ${math_libs} device base
)

install(FILES parallel_2d_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
find_program(BASH bash)
add_test(NAME parallel_2d_test_para4
COMMAND ${BASH} parallel_2d_test.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

AddTest(
TARGET parallel_orbitals_test
SOURCES parallel_orbitals_test.cpp ../parallel_2d.cpp ../parallel_orbitals.cpp
Expand Down
6 changes: 6 additions & 0 deletions source/module_basis/module_ao/test/parallel_2d_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,18 @@ TEST_F(test_para2d, Serial)
//1. set dim0 and dim1
p2d.set_proc_dim(1);
EXPECT_EQ(p2d.dim0 * p2d.dim1, 1);
EXPECT_EQ(p2d.dim0, 1);
EXPECT_EQ(p2d.dim1, 1);

//2. set_serial
p2d.set_serial(gr, gc);
EXPECT_EQ(p2d.get_row_size(), gr);
EXPECT_EQ(p2d.get_col_size(), gc);
EXPECT_EQ(p2d.get_local_size(), gr * gc);
for (int i = 0; i < gr; ++i)
EXPECT_EQ(p2d.local2global_row(i), i);
for (int i = 0; i < gc; ++i)
EXPECT_EQ(p2d.local2global_col(i), i);

//3. set_global2local
p2d.set_global2local(gr, gc, false, ofs_running);
Expand Down
13 changes: 13 additions & 0 deletions source/module_basis/module_ao/test/parallel_2d_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash -e

np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'`
echo "nprocs in this machine is $np"

for i in 2 3 4; do
if [[ $i -gt $np ]];then
continue
fi
echo "TEST in parallel, nprocs=$i"
mpirun -np $i ./parallel_2d_test
break
done