Skip to content

Commit 0405bfd

Browse files
dzzz2001caic99mohanchen
authored
CI: modify CUDA test (#4083)
* modify CUDA test * Update .github/workflows/cuda.yml Co-authored-by: Chun Cai <[email protected]> * change the way of specifying GPU test cases * add .txt suffix to CASES file * Update tests/integrate/Autotest.sh * Update .github/workflows/cuda.yml --------- Co-authored-by: Chun Cai <[email protected]> Co-authored-by: Mohan Chen <[email protected]>
1 parent 48f2b5d commit 0405bfd

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

.github/workflows/cuda.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: CUDA Test
22

33
on:
44
workflow_dispatch:
5+
pull_request:
56

67
jobs:
78
test:
@@ -21,4 +22,7 @@ jobs:
2122
cmake -B build -DUSE_CUDA=ON -DBUILD_TESTING=ON
2223
cmake --build build -j4
2324
cmake --install build
24-
# TODO: add tests
25+
- name: Test
26+
run: |
27+
cd tests/integrate
28+
bash Autotest.sh -n 2 -f CASES_GPU.txt

tests/integrate/Autotest.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ force_threshold=0.0001
1010
stress_threshold=0.001
1111
# check accuracy
1212
ca=8
13+
# specify the test cases file
14+
cases_file=CASES_CPU.txt
1315
# regex of case name
14-
case="^[^#].*_.*$"
16+
case='^[^#].*_.*$'
1517
# enable AddressSanitizer
1618
sanitize=false
1719

18-
while getopts a:n:t:c:s:r:g flag
20+
while getopts a:n:t:c:s:r:g:f flag
1921
do
2022
case "${flag}" in
2123
a) abacus=${OPTARG};;
@@ -25,6 +27,7 @@ do
2527
s) sanitize=${OPTARG};;
2628
r) case=${OPTARG};;
2729
g) g=true;; #generate test reference
30+
f) cases_file=${OPTARG};;
2831
esac
2932
done
3033

@@ -43,7 +46,8 @@ echo "Test accuracy totenergy: $threshold eV"
4346
echo "Test accuracy force: $force_threshold"
4447
echo "Test accuracy stress: $stress_threshold"
4548
echo "Check accuaracy: $ca"
46-
echo "Test cases: $case"
49+
echo "Test cases file: $cases_file"
50+
echo "Test cases regex: $case"
4751
echo "Generate reference: $g"
4852
echo "--------------------------------"
4953
echo ""
@@ -164,10 +168,10 @@ check_out(){
164168
# the file name that contains all of the tests
165169
#---------------------------------------------
166170

167-
test -e CASES || (echo "Plese specify tests." && exit 1)
171+
test -e $cases_file || (echo "Please specify test cases file by -f option." && exit 1)
168172
which $abacus > /dev/null || (echo "No ABACUS executable was found." && exit 1)
169173

170-
testdir=`cat CASES | grep -E $case`
174+
testdir=`cat $cases_file | grep -E $case`
171175
failed=0
172176
failed_case_list=()
173177
ok=0
File renamed without changes.

tests/integrate/CASES_GPU.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)