From 495b72840e000049ce73127c8764496746f0de46 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 2 Aug 2023 05:16:55 +0000 Subject: [PATCH] Test: add parallel scripts for parallel_orbitals unit tests --- source/module_basis/module_ao/test/CMakeLists.txt | 9 ++++++++- .../module_basis/module_ao/test/parallel_2d_test.sh | 1 - .../module_ao/test/parallel_orbitals_test.sh | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100755 source/module_basis/module_ao/test/parallel_orbitals_test.sh diff --git a/source/module_basis/module_ao/test/CMakeLists.txt b/source/module_basis/module_ao/test/CMakeLists.txt index 0e37619147e..626e8b27fe3 100644 --- a/source/module_basis/module_ao/test/CMakeLists.txt +++ b/source/module_basis/module_ao/test/CMakeLists.txt @@ -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} ) @@ -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) diff --git a/source/module_basis/module_ao/test/parallel_2d_test.sh b/source/module_basis/module_ao/test/parallel_2d_test.sh index 94c60d40009..b0d4ce11af2 100755 --- a/source/module_basis/module_ao/test/parallel_2d_test.sh +++ b/source/module_basis/module_ao/test/parallel_2d_test.sh @@ -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 diff --git a/source/module_basis/module_ao/test/parallel_orbitals_test.sh b/source/module_basis/module_ao/test/parallel_orbitals_test.sh new file mode 100755 index 00000000000..b2bd73352b0 --- /dev/null +++ b/source/module_basis/module_ao/test/parallel_orbitals_test.sh @@ -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