Skip to content

Commit

Permalink
Test: add parallel scripts for parallel_orbitals unit tests (#2778)
Browse files Browse the repository at this point in the history
Co-authored-by: root <hongriTianqi>
  • Loading branch information
hongriTianqi authored Aug 2, 2023
1 parent 1437a1f commit 9fd67cb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion source/module_basis/module_ao/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ AddTest(

install(FILES parallel_2d_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
find_program(BASH bash)
add_test(NAME parallel_2d_test_para4
add_test(NAME parallel_2d_test_para
COMMAND ${BASH} parallel_2d_test.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
Expand All @@ -127,6 +127,13 @@ AddTest(
LIBS ${math_libs} device base
)

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

install(DIRECTORY lcao_H2O DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
install(DIRECTORY lcao_H2O DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../../../tests)

1 change: 0 additions & 1 deletion source/module_basis/module_ao/test/parallel_2d_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ for i in 2 3 4; do
fi
echo "TEST in parallel, nprocs=$i"
mpirun -np $i ./parallel_2d_test
break
done
12 changes: 12 additions & 0 deletions source/module_basis/module_ao/test/parallel_orbitals_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/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_orbitals_test
done

0 comments on commit 9fd67cb

Please sign in to comment.