Skip to content

Commit d482013

Browse files
committed
Use environment variable instead to allow OpenMPI run as root
1 parent 52a15fc commit d482013

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

source/source_lcao/module_operator_lcao/test/parallel_operator_tests.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33
np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'`
44
echo "nprocs in this machine is $np"
55

6+
# Allow OpenMPI run as root
7+
export OMPI_ALLOW_RUN_AS_ROOT=1
8+
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
9+
610
for i in 2 3 4; do
711
if [[ $i -gt $np ]];then
812
continue
913
fi
1014
echo "TEST in parallel, nprocs=$i"
11-
mpirun --allow-run-as-root -np $i ./MODULE_LCAO_operator_overlap_cd_test
15+
mpirun -np $i ./MODULE_LCAO_operator_overlap_cd_test
1216
e1=$?
13-
mpirun --allow-run-as-root -np $i ./MODULE_LCAO_operator_overlap_test
17+
mpirun -np $i ./MODULE_LCAO_operator_overlap_test
1418
e2=$?
15-
mpirun --allow-run-as-root -np $i ./MODULE_LCAO_operator_ekinetic_test
19+
mpirun -np $i ./MODULE_LCAO_operator_ekinetic_test
1620
e3=$?
17-
mpirun --allow-run-as-root -np $i ./MODULE_LCAO_operator_nonlocal_test
21+
mpirun -np $i ./MODULE_LCAO_operator_nonlocal_test
1822
e4=$?
19-
mpirun --allow-run-as-root -np $i ./MODULE_LCAO_operator_T_NL_cd_test
23+
mpirun -np $i ./MODULE_LCAO_operator_T_NL_cd_test
2024
e5=$?
2125
if [[ $e1 -ne 0 || $e2 -ne 0 || $e3 -ne 0 || $e4 -ne 0 || $e5 -ne 0 ]]; then
2226
echo -e "\e[1;33m [ FAILED ] \e[0m"\

tests/17_DS_DFTU/run_scf_nscf.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ MPI_NP="${2:-4}"
3131
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
3232
TEST_DIR="$(pwd)"
3333

34+
# Allow OpenMPI run as root
35+
export OMPI_ALLOW_RUN_AS_ROOT=1
36+
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
37+
3438
echo "========================================"
3539
echo " SCF + NSCF Workflow"
3640
echo "========================================"
@@ -94,7 +98,7 @@ echo "-----------------"
9498
echo ""
9599
echo "[1/4] Running SCF calculation..."
96100
cd "${SCF_DIR}"
97-
mpirun -np ${MPI_NP} --allow-run-as-root "${ABACUS}" > scf.log 2>&1 || {
101+
mpirun -np ${MPI_NP} "${ABACUS}" > scf.log 2>&1 || {
98102
echo "ERROR: SCF calculation failed!"
99103
echo "Check ${SCF_DIR}/scf.log for details"
100104
cd "${TEST_DIR}"
@@ -146,7 +150,7 @@ fi
146150
# Step 4: Run NSCF calculation
147151
# -------------------------------------------------------
148152
echo "[3/4] Running NSCF calculation..."
149-
mpirun -np ${MPI_NP} --allow-run-as-root "${ABACUS}" > nscf.log 2>&1 || {
153+
mpirun -np ${MPI_NP} "${ABACUS}" > nscf.log 2>&1 || {
150154
echo "ERROR: NSCF calculation failed!"
151155
echo "Check ${TEST_DIR}/nscf.log for details"
152156
exit 1

0 commit comments

Comments
 (0)