Skip to content
Open
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
2 changes: 0 additions & 2 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@ jobs:
with:
python-version: '3.12'
- uses: pre-commit/action@v3.0.1
# TODO: Drop "continue-on-error"
continue-on-error: true
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ repos:
- id: mixed-line-ending
args: [--fix=lf]
exclude: '(\.bat|\.cmd)$'
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v23.1.3
hooks:
- id: clang-format
# - repo: https://github.com/pre-commit/mirrors-clang-format
# rev: v23.1.3
# hooks:
# - id: clang-format
Comment thread
Growl1234 marked this conversation as resolved.
Resolved
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
Expand All @@ -19,7 +19,7 @@ repos:
rev: v3.14.1-1
hooks:
- id: shfmt
args: [--write, --language-dialect=bash, --indent=2, --case-indent]
args: [--write, --language-dialect=bash, --indent=2, --case-indent, --space-redirects]
- repo: local
hooks:
- id: abacus-agent-governance
Expand Down
27 changes: 13 additions & 14 deletions examples/13_dos/01_pw_Al/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t

rm INPUT KPT

if [[ ! -f scf.output ]] ||
[[ ! -f nscf.output ]] ||
[[ ! -f OUT.ABACUS/running_scf.log ]] ||
[[ ! -f OUT.ABACUS/running_nscf.log ]] ||
[[ ! -f OUT.ABACUS/doss1.txt ]] ||
[[ ! -f OUT.ABACUS/chg.cube ]] ||
[[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] ||
[[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]]
then
echo "job failed!"
exit 1
if [[ ! -f scf.output ]] ||
[[ ! -f nscf.output ]] ||
[[ ! -f OUT.ABACUS/running_scf.log ]] ||
[[ ! -f OUT.ABACUS/running_nscf.log ]] ||
[[ ! -f OUT.ABACUS/doss1.txt ]] ||
[[ ! -f OUT.ABACUS/chg.cube ]] ||
[[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] ||
[[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then
echo "job failed!"
exit 1
else
echo "job succeeded!"
exit 0
fi
echo "job succeeded!"
exit 0
fi
27 changes: 13 additions & 14 deletions examples/13_dos/02_lcao_Si2/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t

rm INPUT KPT

if [[ ! -f scf.output ]] ||
[[ ! -f nscf.output ]] ||
[[ ! -f OUT.ABACUS/running_scf.log ]] ||
[[ ! -f OUT.ABACUS/running_nscf.log ]] ||
[[ ! -f OUT.ABACUS/doss1.txt ]] ||
[[ ! -f OUT.ABACUS/chg.cube ]] ||
[[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] ||
[[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]]
then
echo "job failed!"
exit 1
if [[ ! -f scf.output ]] ||
[[ ! -f nscf.output ]] ||
[[ ! -f OUT.ABACUS/running_scf.log ]] ||
[[ ! -f OUT.ABACUS/running_nscf.log ]] ||
[[ ! -f OUT.ABACUS/doss1.txt ]] ||
[[ ! -f OUT.ABACUS/chg.cube ]] ||
[[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] ||
[[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then
echo "job failed!"
exit 1
else
echo "job succeeded!"
exit 0
fi
echo "job succeeded!"
exit 0
fi
10 changes: 5 additions & 5 deletions examples/32_bsse/01_water/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ E_O=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_O.log | awk '{printf $2}')
E_H1=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_H1.log | awk '{printf $2}')
E_H2=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_H2.log | awk '{printf $2}')
result=$(echo "scale=12; ${E_H2O} - ${E_O} - ${E_H1} - ${E_H2}" | bc -l)
echo $result >result.out
echo "E_H2O: $E_H2O" >>result.out
echo "E_O: $E_O" >>result.out
echo "E_H1: $E_H1" >>result.out
echo "E_H2: $E_H2" >>result.out
echo $result > result.out
echo "E_H2O: $E_H2O" >> result.out
echo "E_O: $E_O" >> result.out
echo "E_H1: $E_H1" >> result.out
echo "E_H2: $E_H2" >> result.out
result_ref=$(cat result.ref | head -1)
difference=$(echo "scale=12; $result - $result_ref" | bc -l)
abs_difference=$(echo "scale=12; if ($difference < 0) $difference * -1 else $difference" | bc)
Expand Down
26 changes: 13 additions & 13 deletions generate_build_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ OUTPUT_FILE=$1
get_version_from_command() {
local cmd="$1"
local regex="$2"
if command -v "$cmd" >/dev/null; then
if command -v "$cmd" > /dev/null; then
local output=$($cmd 2>&1)
if [[ $output =~ $regex ]]; then
echo "${BASH_REMATCH[1]}"
Expand Down Expand Up @@ -71,7 +71,7 @@ MPI_VERSION="no"
if [ "${ENABLE_MPI}" == "ON" ]; then
MPI_IMPLEMENTATION="Unknown"
MPI_COMPILER="${MPI_CXX_COMPILER:-mpicxx}"
if command -v "$MPI_COMPILER" >/dev/null; then
if command -v "$MPI_COMPILER" > /dev/null; then
# Intel MPI (oneAPI)
version=$(get_version_from_command "$MPI_COMPILER --version" "Intel\(R\) oneAPI DPC\+\+/C\+\+ Compiler ([0-9]+\.[0-9]+\.[0-9]+)")
if [ -n "$version" ]; then
Expand Down Expand Up @@ -103,7 +103,7 @@ if [ "${ENABLE_MPI}" == "ON" ]; then
fi
fi
# Fallback via mpirun
if [ -z "$version" ] && command -v mpirun >/dev/null; then
if [ -z "$version" ] && command -v mpirun > /dev/null; then
mr_out=$(mpirun --version 2>&1)
if [[ $mr_out =~ Open\ MPI\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then
MPI_IMPLEMENTATION="OpenMPI"
Expand All @@ -125,8 +125,8 @@ OPENMP_VERSION="no"
if [[ "$CXX_FLAGS" == *"-fopenmp"* ]]; then
OPENMP_VERSION="yes (version unknown)"
# Try to get version from compiler
if command -v "$CXX_COMPILER_PATH" >/dev/null; then
version=$($CXX_COMPILER_PATH -dM -E - </dev/null 2>&1 | grep '#define _OPENMP ' | awk '{print $3}')
if command -v "$CXX_COMPILER_PATH" > /dev/null; then
version=$($CXX_COMPILER_PATH -dM -E - < /dev/null 2>&1 | grep '#define _OPENMP ' | awk '{print $3}')
if [ -n "$version" ]; then
# Convert YYYYMM to a more readable format if possible
year=$((version / 10000))
Expand Down Expand Up @@ -154,8 +154,8 @@ LIBXC_VERSION="no"
if [ "${ENABLE_LIBXC}" == "ON" ]; then
LIBXC_VERSION="yes (version unknown)"
# Try pkg-config first
if command -v pkg-config >/dev/null; then
version=$(pkg-config --modversion libxc 2>/dev/null)
if command -v pkg-config > /dev/null; then
version=$(pkg-config --modversion libxc 2> /dev/null)
if [ -n "$version" ]; then LIBXC_VERSION="yes (v$version)"; fi
fi
# Fallback to header
Expand All @@ -173,7 +173,7 @@ if [ "${USE_CUDA}" == "ON" ]; then
if [ -n "$CUDA_HOME" ]; then
version=$(get_version_from_command "$CUDA_HOME/bin/nvcc --version" "release ([0-9]+\.[0-9]+)")
if [ -n "$version" ]; then CUDA_VERSION="yes (v$version)"; fi
elif command -v nvcc >/dev/null; then
elif command -v nvcc > /dev/null; then
version=$(get_version_from_command "nvcc --version" "release ([0-9]+\.[0-9]+)")
if [ -n "$version" ]; then CUDA_VERSION="yes (v$version)"; fi
fi
Expand All @@ -186,7 +186,7 @@ if [ "${USE_ROCM}" == "ON" ]; then
if [ -n "$ROCM_PATH" ]; then
version=$(get_version_from_command "$ROCM_PATH/bin/hipcc --version" "HIP version: ([0-9]+\.[0-9]+\.[0-9]+)")
if [ -n "$version" ]; then ROCM_VERSION="yes (v$version)"; fi
elif command -v hipcc >/dev/null; then
elif command -v hipcc > /dev/null; then
version=$(get_version_from_command "hipcc --version" "HIP version: ([0-9]+\.[0-9]+\.[0-9]+)")
if [ -n "$version" ]; then ROCM_VERSION="yes (v$version)"; fi
fi
Expand All @@ -205,7 +205,7 @@ ELPA_VERSION="no"
if [ "${ENABLE_ELPA}" == "ON" ] && [ -n "$ELPA_DIR" ]; then
ELPA_VERSION="yes (version unknown)"
if [ -f "$ELPA_DIR/bin/elpa2_print_version" ]; then
version=$("$ELPA_DIR/bin/elpa2_print_version" 2>/dev/null)
version=$("$ELPA_DIR/bin/elpa2_print_version" 2> /dev/null)
if [ -n "$version" ]; then ELPA_VERSION="yes ($version)"; fi
else
ELPA_VERSION="yes (path: $ELPA_DIR)"
Expand Down Expand Up @@ -258,8 +258,8 @@ fi
# CUDA-aware MPI
CUDA_AWARE_MPI="no"
if [ "${USE_CUDA}" == "ON" ]; then
if command -v ompi_info >/dev/null; then
out=$(ompi_info --parsable --all 2>/dev/null)
if command -v ompi_info > /dev/null; then
out=$(ompi_info --parsable --all 2> /dev/null)
if echo "$out" | grep -q "mpi_built_with_cuda_support:value:true"; then
CUDA_AWARE_MPI="yes"
else
Expand Down Expand Up @@ -304,6 +304,6 @@ sed \
-e "s#@ABACUS_ASAN_STATUS@#${ENABLE_ASAN:-no}#g" \
-e "s#@ABACUS_CMAKE_OPTIONS@#Not available with Makefile#g" \
-e "s#@ABACUS_CMAKE_FIND_PACKAGES@#Not available with Makefile#g" \
"$INPUT_FILE" >"$OUTPUT_FILE"
"$INPUT_FILE" > "$OUTPUT_FILE"

echo "Generated $OUTPUT_FILE successfully."
4 changes: 2 additions & 2 deletions interfaces/ShengBTE_interface/01_pw/3rd/run_stru.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for i in STRU_*; do
mkdir SCF-$stru
cd SCF-$stru
pwd
cat >INPUT <<EOF
cat > INPUT << EOF
INPUT_PARAMETERS
#Parameters (General)
suffix DIA-50-$stru
Expand All @@ -32,7 +32,7 @@ mixing_beta 0.7

stru_file STRU_$stru
EOF
cat >KPT <<EOF
cat > KPT << EOF
K_POINTS
0
Gamma
Expand Down
4 changes: 2 additions & 2 deletions interfaces/ShengBTE_interface/02_lcao/3rd/run_stru.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for i in STRU_*; do
mkdir SCF-$stru
cd SCF-$stru
pwd
cat >INPUT <<EOF
cat > INPUT << EOF
INPUT_PARAMETERS
#Parameters (General)
suffix DIA-50-$stru
Expand All @@ -33,7 +33,7 @@ mixing_beta 0.7

stru_file STRU_$stru
EOF
cat >KPT <<EOF
cat > KPT << EOF
K_POINTS
0
Gamma
Expand Down
7 changes: 4 additions & 3 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ if(USE_DSP)
endif()
list(APPEND _abacus_linalg_libs ${_abacus_cpack_library})
else()
message(STATUS
"USE_DSP without MT_CPACK_DIR: C_PACK disabled, the serial generalized "
"eigensolver falls back to the configured LAPACK provider (zhegvx).")
message(
STATUS
"USE_DSP without MT_CPACK_DIR: C_PACK disabled, the serial generalized "
"eigensolver falls back to the configured LAPACK provider (zhegvx).")
endif()
endif()

Expand Down
11 changes: 4 additions & 7 deletions source/source_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,17 @@ endif()

if(BUILD_TESTING)
# TODO: classify the serial and parrallel tests
AddTest(
addtest(
TARGET MODULE_BASE_block_cyclic_distribution
LIBS parameter base device container
SOURCES test/test_block_cyclic_distribution.cpp
)
SOURCES test/test_block_cyclic_distribution.cpp)
if(ENABLE_MPI)
add_test(
NAME MODULE_BASE_block_cyclic_distribution_mpi
COMMAND
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4
${MPIEXEC_PREFLAGS}
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:MODULE_BASE_block_cyclic_distribution>
${MPIEXEC_POSTFLAGS}
)
${MPIEXEC_POSTFLAGS})
add_subdirectory(test)
add_subdirectory(test_parallel)
add_subdirectory(kernels/test)
Expand Down
5 changes: 2 additions & 3 deletions source/source_base/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ if(ENABLE_GOOGLEBENCH)
SOURCES perf_sphbes_test.cpp ../math_sphbes.cpp ../timer.cpp)
endif()

AddTest(
addtest(
TARGET MODULE_BASE_filename
LIBS parameter base device
SOURCES test_filename.cpp
)
SOURCES test_filename.cpp)
2 changes: 1 addition & 1 deletion source/source_base/test_parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ add_test(
COMMAND mpirun -np 4 "$<TARGET_FILE:MODULE_BASE_para_gemm>"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

AddTest(
addtest(
TARGET MODULE_BASE_parallel_domain_grid
SOURCES parallel_domain_grid_test.cpp ../test/mpi_test_main.cpp
LIBS parameter MPI::MPI_CXX base device)
Expand Down
2 changes: 1 addition & 1 deletion source/source_basis/module_ao/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ list(
../../../source_base/libm/sincos.cpp
../../../source_base/sph_bessel_tf.cpp
../../../source_base/cubic_spline.cpp
../../../source_base/block_cyclic_distribution.cpp
../../../source_base/block_cyclic_distribution.cpp
../orb_read.cpp
../orb_atomic.cpp
../orb_atomic_lm.cpp
Expand Down
8 changes: 4 additions & 4 deletions source/source_basis/module_pw/test/test_gnu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

make clean >/dev/null 2>&1
make clean > /dev/null 2>&1

for ((i = 0; i < 4; ++i)); do

Expand All @@ -27,17 +27,17 @@ for ((i = 0; i < 4; ++i)); do
./pw_test.exe
sleep 1
echo "3 processors:"
mpirun -np 3 ./pw_test.exe >_tmp.txt
mpirun -np 3 ./pw_test.exe > _tmp.txt
cat _tmp.txt | grep PASSED
cat _tmp.txt | grep FAILED
sleep 1
echo "5 processors:"
mpirun -np 5 ./pw_test.exe >_tmp.txt
mpirun -np 5 ./pw_test.exe > _tmp.txt
cat _tmp.txt | grep PASSED
cat _tmp.txt | grep FAILED
sleep 1
echo "8 processors:"
mpirun -np 8 ./pw_test.exe >_tmp.txt
mpirun -np 8 ./pw_test.exe > _tmp.txt
cat _tmp.txt | grep PASSED
cat _tmp.txt | grep FAILED
fi
Expand Down
18 changes: 9 additions & 9 deletions source/source_basis/module_pw/test/test_intel.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
#!/bin/bash

make clean >/dev/null 2>&1
make clean > /dev/null 2>&1

for ((i = 0; i < 4; ++i)); do

if ((i == 0)); then
make -j12 CXX=icpc >/dev/null
make -j12 CXX=icpc > /dev/null
echo "Test for Serial Version:"
./pw_test.exe

elif ((i == 1)); then
make -j12 CXX=icpc FLOAT=ON >/dev/null
make -j12 CXX=icpc FLOAT=ON > /dev/null
echo "Test for Serial Version with single precision:"
./pw_test.exe

elif ((i == 2)); then
make -j12 CXX=mpiicpc >/dev/null
make -j12 CXX=mpiicpc > /dev/null
echo "Test for MPI Version:"

elif ((i == 3)); then
make -j12 CXX=mpiicpc FLOAT=ON >/dev/null
make -j12 CXX=mpiicpc FLOAT=ON > /dev/null
echo "Test for MPI Version with single precision:"
fi
if ((i >= 2)); then
echo "1 processor:"
./pw_test.exe
sleep 1
echo "3 processors:"
mpirun -np 3 ./pw_test.exe >_tmp.txt
mpirun -np 3 ./pw_test.exe > _tmp.txt
cat _tmp.txt | grep PASSED
cat _tmp.txt | grep FAILED
sleep 1
echo "5 processors:"
mpirun -np 5 ./pw_test.exe >_tmp.txt
mpirun -np 5 ./pw_test.exe > _tmp.txt
cat _tmp.txt | grep PASSED
cat _tmp.txt | grep FAILED
sleep 1
echo "8 processors:"
mpirun -np 8 ./pw_test.exe >_tmp.txt
mpirun -np 8 ./pw_test.exe > _tmp.txt
cat _tmp.txt | grep PASSED
cat _tmp.txt | grep FAILED
fi

make clean >/dev/null 2>&1
make clean > /dev/null 2>&1

done

Expand Down
Loading
Loading