mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-23 04:43:50 +01:00
Fix for travis (add Read_compilation)
This commit is contained in:
parent
4acab896be
commit
dff2d2f8fa
@ -15,4 +15,5 @@ script:
|
||||
- cp ./src/Makefile.config.gfortran ./src/Makefile.config
|
||||
- ./scripts/compilation/create_ninja_build.py > build.ninja
|
||||
- ./ninja/ninja
|
||||
- cd ocaml ; make ;
|
||||
- ./tests/unit_test/unit_test.py
|
||||
|
@ -35,7 +35,7 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore
|
||||
executables: $(QPACKAGE_ROOT)/data/executables
|
||||
|
||||
$(QPACKAGE_ROOT)/data/executables:
|
||||
$(QPACKAGE_ROOT)/scripts/module/create_executables_list.sh
|
||||
$(QPACKAGE_ROOT)/scripts/create/create_executables_list.sh
|
||||
|
||||
external_libs:
|
||||
opam install cryptokit core
|
||||
@ -62,11 +62,17 @@ qp_run.native: $(MLFILES) $(MLIFILES) executables
|
||||
$(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS)
|
||||
ln -s $*.native $*
|
||||
|
||||
ezfio.ml: ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml
|
||||
cp ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml .
|
||||
|
||||
qptypes_generator.byte: qptypes_generator.ml
|
||||
$(OCAMLBUILD) qptypes_generator.byte -use-ocamlfind
|
||||
|
||||
Qptypes.ml: qptypes_generator.byte
|
||||
./qptypes_generator.byte > Qptypes.ml
|
||||
|
||||
${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml:
|
||||
$(MAKE) -C ${QPACKAGE_ROOT}/src ezfio
|
||||
|
||||
clean:
|
||||
rm -rf _build Qptypes.ml $(ALL_EXE) $(ALL_TESTS)
|
||||
|
20
scripts/compilation/compilation.cfg
Normal file
20
scripts/compilation/compilation.cfg
Normal file
@ -0,0 +1,20 @@
|
||||
[OPTION]
|
||||
OPENMP: 1
|
||||
PROFILE: 0
|
||||
DEBUG: 0
|
||||
|
||||
[COMMON]
|
||||
FC: gfortran -ffree-line-length-none -march=native
|
||||
FCFLAGS: -ffast-math -Ofast
|
||||
MKL: -lblas -llapack
|
||||
|
||||
[OPENMP]
|
||||
FC: -fopenmp
|
||||
IRPF90_FLAGS: --openmp
|
||||
|
||||
[PROFILE]
|
||||
FC: -p -g
|
||||
CXX: -pg
|
||||
|
||||
[DEBUG]
|
||||
FCFLAGS: -fcheck=all
|
@ -2,6 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from os.path import join
|
||||
|
||||
@ -22,8 +23,10 @@ EZ_handler = namedtuple('EZ_handler', ['ez_module', 'ez_cfg', 'ez_interface', 'e
|
||||
try:
|
||||
from module_handler import module_genealogy
|
||||
from cache import cache
|
||||
from read_compilation_cfg import get_compilation_option
|
||||
except ImportError:
|
||||
print "source .quantum_package.rc"
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# _
|
||||
@ -214,8 +217,14 @@ def ninja_ezfio_config_build(l_ezfio_config):
|
||||
def ninja_ezfio_rule():
|
||||
# Rule
|
||||
l_string = ["rule build_ezfio"]
|
||||
l_string += [" command = cd {0}; make ; cd -".format(qpackage_root_ezfio)]
|
||||
l_string += [" description = Make ezfio"]
|
||||
|
||||
l_flag = []
|
||||
for flag in ["FC", "FCFLAGS", "IRPF90"]:
|
||||
str_ = "export {0}='{1}'".format(flag, get_compilation_option(flag))
|
||||
l_flag.append(str_)
|
||||
|
||||
l_cmd = ["cd {0}".format(qpackage_root_ezfio)] + l_flag + ["make", "make Python"]
|
||||
l_string += [" command = {0}".format(" ; ".join(l_cmd))]
|
||||
|
||||
return l_string
|
||||
|
||||
@ -408,7 +417,7 @@ def get_ml_file(l_util, l_qp):
|
||||
|
||||
def ninja_ocaml_rule():
|
||||
# Rule
|
||||
cmd = " command = cd {0} ; make -j 1 $binary ; touch $binary; cd -"
|
||||
cmd = " command = cd {0} ; make -j 1 $native ; touch $native; ln -sf $native $binary; cd -"
|
||||
|
||||
l_string = ["rule build_ocaml"]
|
||||
l_string += [cmd.format(qpackage_root_ocaml)]
|
||||
@ -456,15 +465,16 @@ def ninja_ocaml_build(l_bin_ml, l_ml):
|
||||
# Rule
|
||||
|
||||
ezfio_ml = join(qpackage_root_ocaml, "ezfio.ml")
|
||||
exc = join(qpackage_root, "data", "executables")
|
||||
# exc = join(qpackage_root, "data", "executables")
|
||||
|
||||
str_depend = " ".join(l_ml + l_bin_ml + [ezfio_ml, exc])
|
||||
str_depend = " ".join(l_ml + l_bin_ml + [ezfio_ml])
|
||||
|
||||
l_string = [""]
|
||||
for bin_ in [i.replace(".ml", ".native") for i in l_bin_ml]:
|
||||
binary_name = os.path.split(bin_)[1]
|
||||
l_string += ["build {0}: build_ocaml {1} ".format(bin_, str_depend)]
|
||||
l_string += [" binary = {0}".format(binary_name)]
|
||||
l_string += [" native = {0}".format(binary_name)]
|
||||
l_string += [" binary = {0}".format(binary_name.replace(".native", ""))]
|
||||
l_string += [""]
|
||||
|
||||
return l_string
|
||||
@ -578,8 +588,8 @@ if __name__ == "__main__":
|
||||
l_qp = get_qp_file()
|
||||
l_ml = get_ml_file(l_util, l_qp)
|
||||
|
||||
l_string += ninja_ml_build(l_util)
|
||||
l_string += ninja_ocaml_build(l_qp, l_ml)
|
||||
# l_string += ninja_ml_build(l_util)
|
||||
# l_string += ninja_ocaml_build(l_qp, l_ml)
|
||||
|
||||
# _ _
|
||||
# |_) o | _| _|_ _ ._ ._ _ _ _| | _
|
||||
@ -588,6 +598,7 @@ if __name__ == "__main__":
|
||||
#
|
||||
with open(join(qpackage_root_src, "NEEDED_MODULES"), "r") as f:
|
||||
l_module_to_compile = f.read().split()
|
||||
l_module_to_compile = ["Hartree_Fock"]
|
||||
|
||||
d_info_module = dict_needed_modules(l_module_to_compile)
|
||||
|
||||
|
39
scripts/compilation/read_compilation_cfg.py
Executable file
39
scripts/compilation/read_compilation_cfg.py
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import ConfigParser
|
||||
import sys
|
||||
from cache import cache
|
||||
|
||||
qpackage_root = os.environ['QPACKAGE_ROOT']
|
||||
|
||||
Config = ConfigParser.ConfigParser()
|
||||
pwd = os.path.join(qpackage_root, "scripts/compilation/compilation.cfg")
|
||||
Config.read(pwd)
|
||||
|
||||
|
||||
@cache
|
||||
def get_l_option_section():
|
||||
return [o for o in ['OPENMP', 'PROFILE', 'DEBUG'] if Config.getboolean("OPTION", o)]
|
||||
|
||||
|
||||
@cache
|
||||
def get_compilation_option(name):
|
||||
|
||||
l_option_section = get_l_option_section()
|
||||
|
||||
l = []
|
||||
for section in ["COMMON"] + l_option_section:
|
||||
try:
|
||||
l.extend(Config.get(section, name).split())
|
||||
except ConfigParser.NoOptionError:
|
||||
pass
|
||||
|
||||
return " ".join(l)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
name = sys.argv[1]
|
||||
|
||||
print get_compilation_option(name)
|
Loading…
Reference in New Issue
Block a user