10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-24 13:23:41 +01:00

Upgrade to OCaml 4.06 and Core 0.10

This commit is contained in:
Anthony Scemama 2018-01-22 01:19:03 +01:00
parent 02161df6d0
commit 35708de944
12 changed files with 55 additions and 53 deletions

View File

@ -1,7 +1,9 @@
## IMPORTANT ## IMPORTANT
If you have problems upgrading to the current version, consider re-installing everything from scratch including the OCaml compiler. If you have problems upgrading to the current version, first try
To do this, you will have to remove the `quantum_package` directory **and** the `$HOME/.opam` directory as well. `qp_upgrade_ocaml.sh`. If it fails, then consider re-installing everything from
scratch including the OCaml compiler. To do this, you will have to remove the
`quantum_package` directory **and** the `$HOME/.opam` directory as well.

28
configure vendored
View File

@ -49,7 +49,7 @@ QP_ROOT_INSTALL = join(QP_ROOT, "install")
os.environ["PATH"] = os.environ["PATH"] + ":" + QP_ROOT_BIN os.environ["PATH"] = os.environ["PATH"] + ":" + QP_ROOT_BIN
d_dependency = { d_dependency = {
"ocaml": ["m4", "curl", "zlib", "patch", "gcc", "zeromq"], "ocaml": ["m4", "curl", "zlib", "patch", "gcc", "zeromq", "gmp"],
"m4": ["make"], "m4": ["make"],
"curl": ["make"], "curl": ["make"],
"zlib": ["gcc", "make"], "zlib": ["gcc", "make"],
@ -67,7 +67,8 @@ d_dependency = {
"ninja": ["g++", "python"], "ninja": ["g++", "python"],
"make": [], "make": [],
"p_graphviz": ["python"], "p_graphviz": ["python"],
"bats": [] "bats": [],
"gmp" : ["make", "g++"]
} }
from collections import namedtuple from collections import namedtuple
@ -136,6 +137,11 @@ zeromq = Info(
description=' ZeroMQ', description=' ZeroMQ',
default_path=join(QP_ROOT_LIB, "libzmq.a")) default_path=join(QP_ROOT_LIB, "libzmq.a"))
gmp= Info(
url='https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2',
description=' The GNU Multiple Precision Arithmetic Library',
default_path=join(QP_ROOT_LIB, "libgmp.a"))
f77zmq = Info( f77zmq = Info(
url='{head}/zeromq/f77_zmq/{tail}'.format(**path_github), url='{head}/zeromq/f77_zmq/{tail}'.format(**path_github),
description=' F77-ZeroMQ', description=' F77-ZeroMQ',
@ -155,7 +161,7 @@ d_info = dict()
for m in ["ocaml", "m4", "curl", "zlib", "patch", "irpf90", "docopt", for m in ["ocaml", "m4", "curl", "zlib", "patch", "irpf90", "docopt",
"resultsFile", "ninja", "emsl", "ezfio", "p_graphviz", "resultsFile", "ninja", "emsl", "ezfio", "p_graphviz",
"zeromq", "f77zmq", "bats"]: "zeromq", "f77zmq", "bats", "gmp"]:
exec ("d_info['{0}']={0}".format(m)) exec ("d_info['{0}']={0}".format(m))
@ -480,16 +486,16 @@ def create_ninja_and_rc(l_installed):
'export QP_PYTHON={0}'.format(":".join(l_python)), "", 'export QP_PYTHON={0}'.format(":".join(l_python)), "",
'export IRPF90={0}'.format(path_irpf90.replace(QP_ROOT,"${QP_ROOT}")), 'export IRPF90={0}'.format(path_irpf90.replace(QP_ROOT,"${QP_ROOT}")),
'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")), 'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")),
'function qp_append_export () {', 'function qp_prepend_export () {',
' #Append path $2:${!1}. Add the semicolon only if ${!1} is defined', ' #Prepend path $2:${!1}. Add the semicolon only if ${!1} is defined',
' eval "value_1=\"\${$1}\""', ' eval "value_1=\"\${$1}\""',
' echo ${2}${value_1:+:${value_1}}', ' echo ${value_1:+${value_1}:}${2}',
'}', '}',
'export PYTHONPATH=$(qp_append_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")', 'export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")',
'export PATH=$(qp_append_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)', 'export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)',
'export LD_LIBRARY_PATH=$(qp_append_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)', 'export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
'export LIBRARY_PATH=$(qp_append_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)', 'export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
'export C_INCLUDE_PATH=$(qp_append_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)', 'export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)',
'', '',
'if [[ $SHELL == "bash" ]] ; then', 'if [[ $SHELL == "bash" ]] ; then',
' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh', ' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh',

View File

@ -5,11 +5,12 @@ QP_ROOT=$PWD
cd - cd -
# Normal installation # Normal installation
PACKAGES="core.v0.9.1 cryptokit.1.10 ocamlfind sexplib.v0.9.1 ZMQ ppx_sexp_conv ppx_deriving" PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 ZMQ ppx_sexp_conv ppx_deriving"
# Needed for ZeroMQ # Needed for ZeroMQ
export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_PATH}" export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_PATH}"
export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}" export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}"
export LDFLAGS="-L$QP_ROOT/lib"
export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}"
# return 0 if program version is equal or greater than check version # return 0 if program version is equal or greater than check version
@ -64,7 +65,7 @@ fi
cd Downloads || exit 1 cd Downloads || exit 1
chmod +x ocaml.sh || exit 1 chmod +x ocaml.sh || exit 1
echo N | ./ocaml.sh ${QP_ROOT}/bin/ 4.04.2 || exit 1 echo N | ./ocaml.sh ${QP_ROOT}/bin/ 4.06.0 || exit 1
${QP_ROOT}/bin/opam config setup -a -q || exit 1 ${QP_ROOT}/bin/opam config setup -a -q || exit 1

View File

@ -1,6 +1,7 @@
open Core open Core
open Qptypes open Qptypes
module StringHashtbl = Hashtbl.Make(String)
type pub_state = type pub_state =
| Waiting | Waiting
@ -28,7 +29,7 @@ type t =
progress_bar : Progress_bar.t option ; progress_bar : Progress_bar.t option ;
running : bool; running : bool;
accepting_clients : bool; accepting_clients : bool;
data : (string, string) Hashtbl.t; data : string StringHashtbl.t;
} }
@ -208,7 +209,7 @@ let end_job msg program_state rep_socket pair_socket =
address_inproc = None; address_inproc = None;
running = true; running = true;
accepting_clients = false; accepting_clients = false;
data = Hashtbl.create ~hashable:String.hashable (); data = StringHashtbl.create ();
} }
and wait n = and wait n =
@ -592,7 +593,7 @@ let put_data msg rest_of_msg program_state rep_socket =
in in
let success () = let success () =
Hashtbl.set program_state.data ~key ~data:value ; StringHashtbl.set program_state.data ~key ~data:value ;
Message.PutDataReply (Message.PutDataReply_msg.create ()) Message.PutDataReply (Message.PutDataReply_msg.create ())
|> Message.to_string |> Message.to_string
|> ZMQ.Socket.send rep_socket; |> ZMQ.Socket.send rep_socket;
@ -622,7 +623,7 @@ let get_data msg program_state rep_socket =
let success () = let success () =
let value = let value =
match Hashtbl.find program_state.data key with match StringHashtbl.find program_state.data key with
| Some value -> value | Some value -> value
| None -> "" | None -> ""
in in
@ -776,7 +777,7 @@ let run ~port =
address_inproc = None; address_inproc = None;
progress_bar = None ; progress_bar = None ;
accepting_clients = false; accepting_clients = false;
data = Hashtbl.create ~hashable:String.hashable (); data = StringHashtbl.create ();
} }
in in

View File

@ -665,7 +665,7 @@ let run ?o b au c d m p cart xyz_file =
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> " ~readme:(fun () -> "

View File

@ -128,7 +128,7 @@ let spec =
+> anon ("ezfio_file" %: string) +> anon ("ezfio_file" %: string)
let () = let () =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:( fun () -> " ~readme:( fun () -> "
Creates an open-shell multiplet initial guess\n\n" ) Creates an open-shell multiplet initial guess\n\n" )

View File

@ -95,7 +95,7 @@ let spec =
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> ~readme:(fun () ->
"Find all the pi molecular orbitals to create a pi space. "Find all the pi molecular orbitals to create a pi space.

View File

@ -141,7 +141,7 @@ let run_o ~action ezfio_filename =
;; ;;
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> ~readme:(fun () ->
" "

View File

@ -150,7 +150,7 @@ let spec =
let () = let () =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:( fun () -> " ~readme:( fun () -> "
Executes a Quantum Package binary file among these:\n\n" Executes a Quantum Package binary file among these:\n\n"

View File

@ -323,7 +323,7 @@ let spec =
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> ~readme:(fun () ->
"Set the orbital classes in an EZFIO directory "Set the orbital classes in an EZFIO directory

View File

@ -1,27 +0,0 @@
#!/bin/bash
# Convert a old ezfio file (with option.irp.f ezfio_default)
# into a new EZFIO.cfg type
# Hartree Fock
# Changin the case, don't know if is needed or not
mv $1/Hartree_Fock $1/hartree_fock 2> /dev/null
mv $1/hartree_Fock/thresh_SCF $1/hartree_fock/thresh_scf 2> /dev/null
# BiInts
mv $1/bi_integrals $1/bielect_integrals 2> /dev/null
if [ -f $1/bielect_integrals/read_ao_integrals ]; then
if [ `cat $1/bielect_integrals/read_ao_integrals` -eq "True" ]
then
echo "Read" > $1/bielect_integrals/disk_access_ao_integrals
elif [ `cat bielect_integrals/write_ao_integrals` -eq "True" ]
then
echo "Write" > $1/bielect_integrals/disk_access_ao_integrals
else
echo "None" > $1/bielect_integrals/disk_access_ao_integrals
fi
fi

19
scripts/qp_upgrade_ocaml.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
OCAML_VERSION="4.06.0"
PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 ZMQ ppx_sexp_conv ppx_deriving"
if [[ -z ${QP_ROOT} ]]
then
print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file."
exit -1
fi
cd $QP_ROOT/ocaml
opam update
opam switch ${OCAML_VERSION}
eval `opam config env`
opam install -y ${PACKAGES} || echo "Upgrade failed. You can try running
configure ; $0"