10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 04:43:50 +01:00

We can ninja in a module now

This commit is contained in:
Thomas Applencourt 2015-06-10 15:46:04 +02:00
parent b29219aa69
commit c63f2117cf
3 changed files with 75 additions and 7 deletions

View File

@ -12,7 +12,7 @@ before_script:
script: script:
- ./setup_environment.py - ./setup_environment.py
- source ./quantum_package.rc - source ./quantum_package.rc
- qp_create_ninja.py --production ./config/gfortran.cfg - qp_create_ninja.py create --production ./config/gfortran.cfg
- ninja - ninja
- cd ocaml ; make ; cd - - cd ocaml ; make ; cd -
- cd testing_no_regression ; ./unit_test.py - cd testing_no_regression ; ./unit_test.py

View File

@ -1,7 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Usage: qp_create_ninja.py (--development | --production) CONFIG_FILE Usage: qp_create_ninja.py create (--development | --production) CONFIG_FILE
qp_create_ninja.py update
""" """
import os import os
@ -10,6 +12,7 @@ import glob
from os.path import join from os.path import join
from collections import namedtuple from collections import namedtuple
from collections import defaultdict from collections import defaultdict
import pickle
try: try:
from module_handler import ModuleHandler from module_handler import ModuleHandler
@ -378,7 +381,8 @@ def ninja_irpf90_make_rule():
# c m d # # c m d #
# ~#~#~ # # ~#~#~ #
l_cmd = ["cd $module"] + l_flag + ["irpf90 $include_dir $IRPF90_FLAGS"] l_cmd = ["cd $module", "rm -rf IRPF90_temp IRPF90_man"
] + l_flag + ["irpf90 $include_dir $IRPF90_FLAGS"]
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
# s t r i n g # # s t r i n g #
@ -555,7 +559,7 @@ def ninja_binaries_rule():
# c m d # # c m d #
# ~#~#~ # # ~#~#~ #
l_cmd = ["cd $module", "ninja -C IRPF90_temp $out"] l_cmd = ["cd $module/IRPF90_temp", "ninja $out"]
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
# s t r i n g # # s t r i n g #
@ -589,6 +593,22 @@ def ninja_binaries_build(path_module, l_children, d_binaries):
ninja_module_path), ninja_module_path),
" module = {0}".format(path_module.abs), ""] " module = {0}".format(path_module.abs), ""]
l_string += ["build module_{0}: phony {1}".format(path_module.rel,
" ".join(l_abs_bin)), ""]
return l_string
#
# |\/| _ _| | _
# | | (_) (_| |_| | (/_
#
def create_module_ninja():
"""
In a module create a build.ninja
"""
l_string = ["rule all:"]
return l_string return l_string
@ -624,13 +644,58 @@ def ninja_dot_tree_build(path_module):
return l_string return l_string
#
# |\/| _ _| | _
# | | (_) (_| |_| | (/_
#
def create_ninja_module(path_module):
path_ninja_root = join(QP_ROOT, "build.ninja")
l_string = [
"rule update_ninja_common", " command = qp_create_ninja.py update",
"", "rule make_local_binaries",
" command = ninja -f {0} module_{1}".format(path_ninja_root,
path_module.rel), ""
]
l_string += ["rule make_all_binaries",
" command = ninja -f {0}".format(path_ninja_root), ""]
l_string += ["build dumy_target: update_ninja_common", "",
"build all: make_all_binaries dumy_target", "",
"build local: make_local_binaries dumy_target",
"default local", ""]
path_ninja_cur = join(path_module.abs, "build.ninja")
with open(path_ninja_cur, "w") as f:
f.write("\n".join(l_string))
# #
# |\/| _. o ._ # |\/| _. o ._
# | | (_| | | | # | | (_| | | |
# #
if __name__ == "__main__": if __name__ == "__main__":
arguments = docopt(__doc__) arguments = docopt(__doc__)
pickle_path = os.path.join(QP_ROOT, "config", "qp_create_ninja.pickle")
if arguments["update"]:
try:
with open(pickle_path, 'rb') as handle:
arguments = pickle.load(handle)
except IOError:
print "You need to create first my friend"
sys.exit(1)
elif arguments["create"]:
arguments["CONFIG_FILE"] = os.path.realpath(arguments["CONFIG_FILE"])
with open(pickle_path, 'wb') as handle:
pickle.dump(arguments, handle)
pwd_config_file = arguments["CONFIG_FILE"] pwd_config_file = arguments["CONFIG_FILE"]
# _ # _
@ -704,6 +769,9 @@ if __name__ == "__main__":
for module_to_compile in l_module: for module_to_compile in l_module:
if arguments["--development"]:
create_ninja_module(module_to_compile)
# ~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~ #
# S y m l i n k # # S y m l i n k #
# ~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~ #

View File

@ -589,7 +589,7 @@ Documentation
If true, The One body DM is calculated with ignoring the Double<->Doubles extra diag elements If true, The One body DM is calculated with ignoring the Double<->Doubles extra diag elements
`pouet <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/program_beginer_determinants.irp.f#L1>`_ `pouet <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/program_initial_determinants.irp.f#L1>`_
Undocumented Undocumented
@ -783,7 +783,7 @@ Documentation
be set before calling this function. be set before calling this function.
`routine <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/program_beginer_determinants.irp.f#L7>`_ `routine <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/program_initial_determinants.irp.f#L7>`_
Undocumented Undocumented