9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 14:03:37 +01:00

Compiles with OCaml 4.13.1

This commit is contained in:
Anthony Scemama 2022-06-08 11:08:53 +02:00
parent 60c0f6216a
commit 6861cea2ac
8 changed files with 102 additions and 76 deletions

View File

@ -60,19 +60,14 @@ def main(arguments):
print("Running tests for %s"%(bats_file)) print("Running tests for %s"%(bats_file))
print("") print("")
if arguments["-v"]: if arguments["-v"]:
p = None
if arguments["TEST"]: if arguments["TEST"]:
test = "export TEST=%s ; "%arguments["TEST"] test = "export TEST=%s ; "%arguments["TEST"]
else: else:
test = "" test = ""
try: os.system(test+" python3 bats_to_sh.py "+bats_file+
os.system(test+" python3 bats_to_sh.py "+bats_file+
"| bash") "| bash")
except:
if p:
p.terminate()
else: else:
subprocess.check_call(["bats", bats_file], env=os.environ) subprocess.check_call(["bats", "--verbose-run", "--trace", bats_file], env=os.environ)

4
configure vendored
View File

@ -281,8 +281,8 @@ EOF
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar -zxf qp2-dependencies/bats-v1.1.0.tar.gz tar -zxf qp2-dependencies/bats-v1.7.0.tar.gz
( cd bats-core-1.1.0/ ; ./install.sh \${QP_ROOT}) ( cd bats-core-1.7.0/ ; ./install.sh \${QP_ROOT})
EOF EOF
else else

@ -1 +1 @@
Subproject commit 90ee61f5041c7c94a0c605625a264860292813a0 Subproject commit 242151e03d1d6bf042387226431d82d35845686a

View File

@ -56,3 +56,7 @@ let string_of_string s = s
let list_map f l = let list_map f l =
List.rev_map f l List.rev_map f l
|> List.rev |> List.rev
let socket_convert socket =
((Obj.magic (Obj.repr socket)) : [ `Xsub ] Zmq.Socket.t )

View File

@ -131,37 +131,64 @@ let () =
Sys.set_signal Sys.sigint handler; Sys.set_signal Sys.sigint handler;
let new_thread req_or_sub addr_in addr_out = let new_thread_req addr_in addr_out =
let socket_in, socket_out = let socket_in, socket_out =
match req_or_sub with
| REQ ->
create_socket Zmq.Socket.router Zmq.Socket.bind addr_in, create_socket Zmq.Socket.router Zmq.Socket.bind addr_in,
create_socket Zmq.Socket.dealer Zmq.Socket.connect addr_out create_socket Zmq.Socket.dealer Zmq.Socket.connect addr_out
| SUB ->
create_socket Zmq.Socket.sub Zmq.Socket.connect addr_in,
create_socket Zmq.Socket.pub Zmq.Socket.bind addr_out
in in
if req_or_sub = SUB then
Zmq.Socket.subscribe socket_in "";
let action_in =
fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out
let action_in =
match req_or_sub with
| REQ -> (fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
| SUB -> (fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
in in
let action_out = let action_out =
match req_or_sub with fun () -> Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in
| REQ -> (fun () -> Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in )
| SUB -> (fun () -> () )
in in
let pollitem = let pollitem =
Zmq.Poll.mask_of Zmq.Poll.mask_of
[| (socket_in, Zmq.Poll.In) ; (socket_out, Zmq.Poll.In) |] [| (socket_convert socket_in, Zmq.Poll.In) ; (socket_convert socket_out, Zmq.Poll.In) |]
in
while !run_status do
let polling =
Zmq.Poll.poll ~timeout:1000 pollitem
in
match polling with
| [| Some Zmq.Poll.In ; Some Zmq.Poll.In |] -> ( action_out () ; action_in () )
| [| _ ; Some Zmq.Poll.In |] -> action_out ()
| [| Some Zmq.Poll.In ; _ |] -> action_in ()
| _ -> ()
done;
Zmq.Socket.close socket_in;
Zmq.Socket.close socket_out;
in
let new_thread_sub addr_in addr_out =
let socket_in, socket_out =
create_socket Zmq.Socket.sub Zmq.Socket.connect addr_in,
create_socket Zmq.Socket.pub Zmq.Socket.bind addr_out
in
Zmq.Socket.subscribe socket_in "";
let action_in =
fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out
in
let action_out =
fun () -> ()
in
let pollitem =
Zmq.Poll.mask_of
[| (socket_convert socket_in, Zmq.Poll.In) ; (socket_convert socket_out, Zmq.Poll.In) |]
in in
@ -194,7 +221,7 @@ let () =
in in
let f () = let f () =
new_thread REQ addr_in addr_out new_thread_req addr_in addr_out
in in
(Thread.create f) () (Thread.create f) ()
@ -212,7 +239,7 @@ let () =
in in
let f () = let f () =
new_thread REQ addr_in addr_out new_thread_req addr_in addr_out
in in
(Thread.create f) () (Thread.create f) ()
in in
@ -228,7 +255,7 @@ let () =
in in
let f () = let f () =
new_thread SUB addr_in addr_out new_thread_sub addr_in addr_out
in in
(Thread.create f) () (Thread.create f) ()
in in

View File

@ -37,48 +37,48 @@ function run_stoch() {
qp set_file b2_stretched.ezfio qp set_file b2_stretched.ezfio
qp set determinants n_det_max 10000 qp set determinants n_det_max 10000
qp set_frozen_core qp set_frozen_core
run_stoch -49.14104086 0.0001 10000 run_stoch -49.14097596 0.0001 10000
} }
@test "NH3" { # 0:00:11 @test "NH3" { # 0:00:11
qp set_file nh3.ezfio qp set_file nh3.ezfio
qp set_mo_class --core="[1-4]" --act="[5-72]" qp set_mo_class --core="[1-4]" --act="[5-72]"
run -56.24474790 1.e-5 10000 run -56.24474908 1.e-5 10000
} }
@test "DHNO" { # 0:00:10 @test "DHNO" { # 0:00:10
qp set_file dhno.ezfio qp set_file dhno.ezfio
qp set_mo_class --core="[1-7]" --act="[8-64]" qp set_mo_class --core="[1-7]" --act="[8-64]"
run -130.45901042 1.e-4 10000 run -130.45904647 1.e-4 10000
} }
@test "HCO" { # 0:01:16 @test "HCO" { # 0:01:16
qp set_file hco.ezfio qp set_file hco.ezfio
run_stoch -113.41658256 2.e-3 50000 run_stoch -113.41448940 2.e-3 50000
} }
@test "H2O2" { # 0:01:48 @test "H2O2" { # 0:01:48
qp set_file h2o2.ezfio qp set_file h2o2.ezfio
qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-38]" qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-38]"
run_stoch -151.02317880 2.e-3 100000 run_stoch -151.02437936 2.e-3 100000
} }
@test "HBO" { # 0:00:46 @test "HBO" { # 0:00:46
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file hbo.ezfio qp set_file hbo.ezfio
run_stoch -100.22361288 2.e-3 50000 run_stoch -100.221198108988 2.e-3 50000
} }
@test "H2O" { # 0:01:05 @test "H2O" { # 0:01:05
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file h2o.ezfio qp set_file h2o.ezfio
run_stoch -76.24347962 1.e-4 100000 run_stoch -76.241332121813 1.e-3 100000
} }
@test "ClO" { # 0:03:07 @test "ClO" { # 0:03:07
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file clo.ezfio qp set_file clo.ezfio
run_stoch -534.58202840 1.e-3 100000 run_stoch -534.573564655419 1.e-3 100000
} }
@test "SO" { # 0:01:49 @test "SO" { # 0:01:49

View File

@ -41,7 +41,7 @@ subroutine print_extrapolated_energy
enddo enddo
print *, '' print *, ''
call ezfio_set_fci_energy_extrapolated(extrapolated_energy(2,1:N_states)) call ezfio_set_fci_energy_extrapolated(extrapolated_energy(min(N_iter,3),1:N_states))
end subroutine end subroutine

View File

@ -46,7 +46,7 @@ function test_exe() {
run_only_test() { run_only_test() {
if [[ "$BATS_TEST_DESCRIPTION" != "$1" ]] && [[ "$BATS_TEST_NUMBER" != "$1" ]]; then if [[ "$BATS_TEST_DESCRIPTION" != "$1" ]] && [[ "$BATS_TEST_NUMBER" != "$1" ]]; then
if [[ -z $BATS_TEST_FILENAME ]] ; then if [[ -z "$BATS_TEST_FILENAME" ]] ; then
exit 0 exit 0
else else
skip skip