1 | ### test mpqc jobs
|
---|
2 |
|
---|
3 | # perform test with PoolWorkers using stastand-inn mpqc
|
---|
4 | AT_SETUP([Fragmentation - Automation: mpqc jobs])
|
---|
5 | AT_KEYWORDS([fragmentation automation server poolworker mpqc])
|
---|
6 |
|
---|
7 | # check that ports are unique over all tests such that they may run in parallel
|
---|
8 | WORKERPORT=1060
|
---|
9 | CONTROLLERPORT=1061
|
---|
10 | WORKERLISTENPORT=1062
|
---|
11 |
|
---|
12 | # create job files for stand-in mpqc
|
---|
13 | i=0
|
---|
14 | while test -e ${abs_top_srcdir}/tests/JobMarket/pre/BondFragment`printf %02d $i`.out; do
|
---|
15 | nr=`printf %02d $i`
|
---|
16 | echo "Creating Job${nr}.in"
|
---|
17 | echo "${abs_top_srcdir}/tests/JobMarket/pre/BondFragment${nr}.out" >Job${nr}.in
|
---|
18 | ((i+=1))
|
---|
19 | done
|
---|
20 |
|
---|
21 | # start service in background
|
---|
22 | ${AUTOTEST_PATH}/Server --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
|
---|
23 | server_pid=$!
|
---|
24 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
25 |
|
---|
26 | # add jobs
|
---|
27 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command addjobs --executable "../../mpqc" --jobfiles Job??.in], 0, [ignore], [ignore], [kill $server_pid])
|
---|
28 |
|
---|
29 | # enlist a worker to work on jobs
|
---|
30 | ${AUTOTEST_PATH}/PoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
|
---|
31 | worker_pid=$!
|
---|
32 | AT_CHECK([sleep 5], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
33 |
|
---|
34 | # send removeall to server such that all workers shutdown
|
---|
35 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command removeall], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
|
---|
36 |
|
---|
37 | # check number of done jobs
|
---|
38 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command receivempqc --fragment-path ${abs_top_srcdir}/tests/JobMarket/pre/], 0, [stdout], [ignore], [kill $server_pid])
|
---|
39 | AT_CHECK([fgrep "There are 7 fragments" stdout], 0, [ignore], [ignore], [kill $server_pid])
|
---|
40 | AT_CHECK([fgrep "There are 23 atoms" stdout], 0, [ignore], [ignore], [kill $server_pid])
|
---|
41 | AT_CHECK([fgrep "Resulting energy is -279.837" stdout], 0, [ignore], [ignore], [kill $server_pid])
|
---|
42 | AT_CHECK([fgrep "Resulting forces are" stdout], 0, [ignore], [ignore], [kill $server_pid])
|
---|
43 |
|
---|
44 | # shutdown controller socket
|
---|
45 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid])
|
---|
46 |
|
---|
47 | # check that server is truely down
|
---|
48 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
49 | AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
|
---|
50 |
|
---|
51 | AT_CLEANUP
|
---|