From 746710ea483e267c82e5f8b725ff8c2d9cde5f7d Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Thu, 4 Jun 2020 11:47:23 -0400 Subject: [PATCH 01/32] [cmake] explicitly link cpp2py modules against triqs_py library --- python/app4triqs/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/app4triqs/CMakeLists.txt b/python/app4triqs/CMakeLists.txt index 2c90532..743f1a0 100644 --- a/python/app4triqs/CMakeLists.txt +++ b/python/app4triqs/CMakeLists.txt @@ -13,7 +13,7 @@ endforeach() foreach(gen ${wrap_generators}) string(REPLACE "_desc.py" "" module_name ${gen}) add_cpp2py_module(${module_name}) - target_link_libraries(${module_name} ${PROJECT_NAME}_c) + target_link_libraries(${module_name} ${PROJECT_NAME}_c triqs_py) endforeach() # Install python modules to proper location From c98b36140a0d0b6285e8644ebb5973d9d9a00682 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 8 Jun 2020 14:49:06 -0400 Subject: [PATCH 02/32] [doc] Update autorun to latest version, default to utf8 encoding --- doc/conf.py.in | 4 +- doc/sphinxext/autorun/autorun.py | 104 ------------------ doc/sphinxext/sphinx_autorun/__init__.py | 93 ++++++++++++++++ .../{autorun => sphinx_autorun}/pycon.py | 15 +-- doc/sphinxext/sphinx_autorun/version.py | 4 + 5 files changed, 105 insertions(+), 115 deletions(-) delete mode 100644 doc/sphinxext/autorun/autorun.py create mode 100644 doc/sphinxext/sphinx_autorun/__init__.py rename doc/sphinxext/{autorun => sphinx_autorun}/pycon.py (77%) create mode 100644 doc/sphinxext/sphinx_autorun/version.py diff --git a/doc/conf.py.in b/doc/conf.py.in index 62455e4..577fe4a 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -3,7 +3,7 @@ # TRIQS documentation build configuration file import sys -sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext/autorun") +sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext") sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext/numpydoc") extensions = ['sphinx.ext.autodoc', @@ -14,8 +14,8 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.autosummary', 'sphinx.ext.githubpages', + 'sphinx_autorun', 'matplotlib.sphinxext.plot_directive', - 'autorun', 'numpydoc'] source_suffix = '.rst' diff --git a/doc/sphinxext/autorun/autorun.py b/doc/sphinxext/autorun/autorun.py deleted file mode 100644 index cbd2974..0000000 --- a/doc/sphinxext/autorun/autorun.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- -""" -sphinxcontirb.autorun -~~~~~~~~~~~~~~~~~~~~~~ - -Run the code and insert stdout after the code block. - - -""" -import os -from subprocess import Popen,PIPE - -from docutils import nodes -from docutils.parsers.rst import Directive -from docutils.parsers.rst import directives -from sphinx.errors import SphinxError -from pygments import highlight -from pygments.lexers import PythonLexer -from pygments.formatters import HtmlFormatter - -class RunBlockError(SphinxError): - category = 'runblock error' - -class AutoRun: - here = os.path.abspath(__file__) - pycon = os.path.join(os.path.dirname(here),'pycon.py') - config = dict( - pycon = 'python ' + pycon, - pycon_prefix_chars = 4, - pycon_show_source = False, - console = 'bash', - console_prefix_chars = 1 , - ) - @classmethod - def builder_init(cls,app): - cls.config.update(app.builder.config.autorun_languages) - - - -class RunBlock(Directive): - has_content = True - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = False - option_spec = { - 'linenos': directives.flag, - } - - - def run(self): - config = AutoRun.config - language = self.arguments[0] - - if language not in config: - raise RunBlockError('Unknown language %s' % language) - - - # Get configuration values for the language - args = config[language].split() - #input_encoding = config.get(language+'_input_encoding','ascii') - input_encoding = 'utf8' - output_encoding = 'utf8' - #output_encoding = config.get(language+'_output_encoding','ascii') - prefix_chars = config.get(language+'_prefix_chars',0) - show_source = config.get(language+'_show_source',True) - - - # Build the code text - proc = Popen(args,bufsize=1,stdin=PIPE,stdout=PIPE,stderr=PIPE) - codelines = (line[prefix_chars:] for line in self.content) - code = '\n'.join(codelines).encode(input_encoding) - - # Run the code - stdout,stderr = proc.communicate(code) - - # Process output - out ='' - if stdout: - out += ''.join(stdout).decode(output_encoding) - if stderr: - out += ''.join(stderr).decode(output_encoding) - - # Get the original code with prefixes - if show_source: - code = '\n'.join(self.content) - else: - code = '' - #code_out = u'\n\n ---Output:---\n'.join((highlight(code, PythonLexer(), HtmlFormatter()),out)) - code_out = '\n\n ---Output:---\n'.join((code,out)) - - literal = nodes.literal_block(code_out,code_out) - #literal['language'] = language - literal['language'] = 'python' - literal['linenos'] = 'linenos' in self.options - return [literal] - - - -def setup(app): - app.add_directive('runblock', RunBlock) - app.connect('builder-inited',AutoRun.builder_init) - app.add_config_value('autorun_languages', AutoRun.config, 'env') - -# vim: set expandtab shiftwidth=4 softtabstop=4 : diff --git a/doc/sphinxext/sphinx_autorun/__init__.py b/doc/sphinxext/sphinx_autorun/__init__.py new file mode 100644 index 0000000..1afa037 --- /dev/null +++ b/doc/sphinxext/sphinx_autorun/__init__.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +""" +sphinxcontirb.autorun +~~~~~~~~~~~~~~~~~~~~~~ + +Run the code and insert stdout after the code block. +""" +import os +from subprocess import PIPE, Popen + +from docutils import nodes +from docutils.parsers.rst import Directive, directives +from sphinx.errors import SphinxError + +from sphinx_autorun import version + +__version__ = version.version + + +class RunBlockError(SphinxError): + category = 'runblock error' + + +class AutoRun(object): + here = os.path.abspath(__file__) + pycon = os.path.join(os.path.dirname(here), 'pycon.py') + config = { + 'pycon': 'python ' + pycon, + 'pycon_prefix_chars': 4, + 'pycon_show_source': False, + 'console': 'bash', + 'console_prefix_chars': 1, + } + + @classmethod + def builder_init(cls, app): + cls.config.update(app.builder.config.autorun_languages) + + +class RunBlock(Directive): + has_content = True + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = False + option_spec = { + 'linenos': directives.flag, + } + + def run(self): + config = AutoRun.config + language = self.arguments[0] + + if language not in config: + raise RunBlockError('Unknown language %s' % language) + + # Get configuration values for the language + args = config[language].split() + input_encoding = config.get(language+'_input_encoding', 'utf8') + output_encoding = config.get(language+'_output_encoding', 'utf8') + prefix_chars = config.get(language+'_prefix_chars', 0) + show_source = config.get(language+'_show_source', True) + + # Build the code text + proc = Popen(args, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=PIPE) + codelines = (line[prefix_chars:] for line in self.content) + code = u'\n'.join(codelines).encode(input_encoding) + + # Run the code + stdout, stderr = proc.communicate(code) + + # Process output + if stdout: + out = stdout.decode(output_encoding) + if stderr: + out = stderr.decode(output_encoding) + + # Get the original code with prefixes + if show_source: + code = u'\n'.join(self.content) + code_out = u'\n'.join((code, out)) + else: + code_out = out + + literal = nodes.literal_block(code_out, code_out) + literal['language'] = language + literal['linenos'] = 'linenos' in self.options + return [literal] + + +def setup(app): + app.add_directive('runblock', RunBlock) + app.connect('builder-inited', AutoRun.builder_init) + app.add_config_value('autorun_languages', AutoRun.config, 'env') diff --git a/doc/sphinxext/autorun/pycon.py b/doc/sphinxext/sphinx_autorun/pycon.py similarity index 77% rename from doc/sphinxext/autorun/pycon.py rename to doc/sphinxext/sphinx_autorun/pycon.py index 22ad46c..c0edf86 100644 --- a/doc/sphinxext/autorun/pycon.py +++ b/doc/sphinxext/sphinx_autorun/pycon.py @@ -1,7 +1,7 @@ import sys from code import InteractiveInterpreter - + def main(): """ Print lines of input along with output. @@ -12,23 +12,20 @@ def main(): try: while True: source = next(source_lines) - print('>>>', source) + # Allow the user to ignore specific lines of output. + if not source.endswith('# ignore'): + print('>>>', source) more = console.runsource(source) while more: next_line = next(source_lines) print('...', next_line) - source += '\n' + next_line + source += '\n' + next_line more = console.runsource(source) except StopIteration: if more: print('... ') more = console.runsource(source + '\n') - - + if __name__ == '__main__': main() - - -# vim: set expandtab shiftwidth=4 softtabstop=4 : - diff --git a/doc/sphinxext/sphinx_autorun/version.py b/doc/sphinxext/sphinx_autorun/version.py new file mode 100644 index 0000000..433d173 --- /dev/null +++ b/doc/sphinxext/sphinx_autorun/version.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# file generated by setuptools_scm +# don't change, don't track in version control +version = '1.1.1' From e059d403c16b823db6bdd5f17a71c753f2cb222c Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 8 Jun 2020 14:49:39 -0400 Subject: [PATCH 03/32] [cmake] Generalize desc file detection to allow for modules in subdirectories --- python/app4triqs/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/app4triqs/CMakeLists.txt b/python/app4triqs/CMakeLists.txt index 743f1a0..5de94b6 100644 --- a/python/app4triqs/CMakeLists.txt +++ b/python/app4triqs/CMakeLists.txt @@ -11,8 +11,10 @@ endforeach() # Build any python modules foreach(gen ${wrap_generators}) - string(REPLACE "_desc.py" "" module_name ${gen}) - add_cpp2py_module(${module_name}) + string(REPLACE "_desc.py" "" gen ${gen}) + get_filename_component(module_name ${gen} NAME_WE) + get_filename_component(module_dir ${gen} DIRECTORY) + add_cpp2py_module(NAME ${module_name} DIRECTORY ${module_dir}) target_link_libraries(${module_name} ${PROJECT_NAME}_c triqs_py) endforeach() From 4139230849376405e190c6c5a900ef55fa9f9731 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 8 Jun 2020 15:36:27 -0400 Subject: [PATCH 04/32] [doc] Update url in intersphinx_mapping for python --- doc/conf.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py.in b/doc/conf.py.in index 577fe4a..977f421 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -42,4 +42,4 @@ html_sidebars = {'index': ['sideb.html', 'searchbox.html']} htmlhelp_basename = '@PROJECT_NAME@doc' -intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)} +intersphinx_mapping = {'python': ('http://docs.python.org/3.8', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)} From acd88f1a62e3a00cf227e665163d8e39a999adde Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Tue, 9 Jun 2020 10:40:37 -0400 Subject: [PATCH 05/32] [cmake] Make sure to generate 'make VERBOSE=1' output on build failure --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 00134cf..53b08de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,6 @@ WORKDIR $BUILD/$APPNAME RUN chown build . USER build ARG BUILD_DOC=0 -RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} && make -j2 +RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} && make -j2 || make -j1 VERBOSE=1 USER root RUN make install From b6cedfb0dfdc1f488f7040ab107dd3072bc1d77e Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 10 Jun 2020 16:46:16 -0400 Subject: [PATCH 06/32] [cmake] Provide a namespaced alias to the PROJECT_NAME_warnings target --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e42c001..6d14833 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,7 @@ add_compile_options( # Create an Interface target for compiler warnings add_library(${PROJECT_NAME}_warnings INTERFACE) +add_library(${PROJECT_NAME}::${PROJECT_NAME}_warnings ALIAS ${PROJECT_NAME}_warnings) target_compile_options(${PROJECT_NAME}_warnings INTERFACE -Wall From 612f9b8076ef6a36328b11e81fc405aa2b405e05 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 10 Jun 2020 16:46:58 -0400 Subject: [PATCH 07/32] [doc] Use https over http in intersphinx_mapping --- doc/conf.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py.in b/doc/conf.py.in index 977f421..7662c9b 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -42,4 +42,4 @@ html_sidebars = {'index': ['sideb.html', 'searchbox.html']} htmlhelp_basename = '@PROJECT_NAME@doc' -intersphinx_mapping = {'python': ('http://docs.python.org/3.8', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)} +intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)} From 354f1420c1c4c5bf6c848a3a867fb673f3aa7389 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 10 Jun 2020 16:47:19 -0400 Subject: [PATCH 08/32] [doc] Minor fix in install instructions --- doc/install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install.rst b/doc/install.rst index 08b8543..203ab7c 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -65,7 +65,7 @@ Custom CMake options The compilation of ``app4triqs`` can be configured using CMake-options:: - cmake ../app4triqs.src -DOPTION1=value1 -DOPTION2=value2 ... ../app4triqs.src + cmake ../app4triqs.src -DOPTION1=value1 -DOPTION2=value2 ... +-----------------------------------------------------------------+-----------------------------------------------+ | Options | Syntax | From 5156e45b5bc5a396f688333f84e2c90f05c9eb13 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 10 Jun 2020 16:53:25 -0400 Subject: [PATCH 09/32] [cmake] Make sure to use namespaced targets in c++ test dir --- CMakeLists.txt | 1 - test/c++/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d14833..e42c001 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,7 +100,6 @@ add_compile_options( # Create an Interface target for compiler warnings add_library(${PROJECT_NAME}_warnings INTERFACE) -add_library(${PROJECT_NAME}::${PROJECT_NAME}_warnings ALIAS ${PROJECT_NAME}_warnings) target_compile_options(${PROJECT_NAME}_warnings INTERFACE -Wall diff --git a/test/c++/CMakeLists.txt b/test/c++/CMakeLists.txt index 071b5fd..36466c3 100644 --- a/test/c++/CMakeLists.txt +++ b/test/c++/CMakeLists.txt @@ -11,7 +11,7 @@ foreach(test ${all_tests}) get_filename_component(test_name ${test} NAME_WE) get_filename_component(test_dir ${test} DIRECTORY) add_executable(${test_name} ${test}) - target_link_libraries(${test_name} ${PROJECT_NAME}_c gtest_main ${PROJECT_NAME}_warnings) + target_link_libraries(${test_name} ${PROJECT_NAME}::${PROJECT_NAME}_c ${PROJECT_NAME}_warnings gtest_main) set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) # Run clang-tidy if found From 9b1a3c0e7e7f1f583cb317a3c10583bb5066c3e6 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 10 Jun 2020 18:20:52 -0400 Subject: [PATCH 10/32] [cmake] Make sure to install python files into their proper subdirectories --- python/app4triqs/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/app4triqs/CMakeLists.txt b/python/app4triqs/CMakeLists.txt index 5de94b6..bb55b31 100644 --- a/python/app4triqs/CMakeLists.txt +++ b/python/app4triqs/CMakeLists.txt @@ -22,4 +22,5 @@ endforeach() set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME}) get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST) install(TARGETS ${CPP2PY_MODULES_LIST} DESTINATION ${PYTHON_LIB_DEST}) -install(FILES ${python_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT} FILES_MATCHING PATTERN "*.py" PATTERN "*_desc.py" EXCLUDE) From 74aefcb1dc91687035cd51ee1ce68c95da11196f Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 10 Jun 2020 18:26:34 -0400 Subject: [PATCH 11/32] [cmake] Make sure to install python modules into their proper subdirectories --- python/app4triqs/CMakeLists.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/python/app4triqs/CMakeLists.txt b/python/app4triqs/CMakeLists.txt index bb55b31..df7b79c 100644 --- a/python/app4triqs/CMakeLists.txt +++ b/python/app4triqs/CMakeLists.txt @@ -9,18 +9,17 @@ foreach(file ${python_sources}) configure_file(${file} ${file} COPYONLY) endforeach() -# Build any python modules +# Install python files to proper location +set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT} FILES_MATCHING PATTERN "*.py" PATTERN "*_desc.py" EXCLUDE) + +# Build and install any python modules foreach(gen ${wrap_generators}) string(REPLACE "_desc.py" "" gen ${gen}) get_filename_component(module_name ${gen} NAME_WE) get_filename_component(module_dir ${gen} DIRECTORY) add_cpp2py_module(NAME ${module_name} DIRECTORY ${module_dir}) target_link_libraries(${module_name} ${PROJECT_NAME}_c triqs_py) + install(TARGETS ${module_name} DESTINATION ${PYTHON_LIB_DEST}/${module_dir}) endforeach() - -# Install python modules to proper location -set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME}) -get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST) -install(TARGETS ${CPP2PY_MODULES_LIST} DESTINATION ${PYTHON_LIB_DEST}) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT} FILES_MATCHING PATTERN "*.py" PATTERN "*_desc.py" EXCLUDE) From c2a4685719359a7d906f4d23895636e9184470c4 Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Mon, 15 Jun 2020 10:20:40 -0400 Subject: [PATCH 12/32] [jenkins] bring into closer alignment with triqs --- Jenkinsfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6e7fffb..754e16a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ for (int i = 0; i < dockerPlatforms.size(); i++) { mv -f Dockerfile.jenkins Dockerfile """ /* build and tag */ - def img = docker.build("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_DOC=${platform==documentationPlatform} .") + def img = docker.build("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_DOC=${platform==documentationPlatform} --build-arg BUILD_ID=${env.BUILD_TAG} .") catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { img.inside() { sh "make -C \$BUILD/${projectName} test CTEST_OUTPUT_ON_FAILURE=1" @@ -64,6 +64,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) { def srcDir = pwd() def tmpDir = pwd(tmp:true) def buildDir = "$tmpDir/build" + /* install real branches in a fixed predictable place so apps can find them */ def installDir = keepInstall ? "${env.HOME}/install/${projectName}/${env.BRANCH_NAME}/${platform}" : "$tmpDir/install" def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}" dir(installDir) { @@ -71,15 +72,21 @@ for (int i = 0; i < osxPlatforms.size(); i++) { } checkout scm + + def hdf5 = "${env.BREW}/opt/hdf5@1.10" dir(buildDir) { withEnv(platformEnv[1].collect { it.replace('\$BREW', env.BREW) } + [ - "PATH=$triqsDir/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin", - "CPLUS_INCLUDE_PATH=$triqsDir/include:${env.BREW}/include", - "LIBRARY_PATH=$triqsDir/lib:${env.BREW}/lib", - "CMAKE_PREFIX_PATH=$triqsDir/lib/cmake/triqs"]) { + "PATH=$triqsDir/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin", + "HDF5_ROOT=$hdf5", + "C_INCLUDE_PATH=$hdf5/include:${env.BREW}/include", + "CPLUS_INCLUDE_PATH=$triqsDir/include:$hdf5/include:${env.BREW}/include", + "LIBRARY_PATH=$triqsDir/lib:$hdf5/lib:${env.BREW}/lib", + "LD_LIBRARY_PATH=$hdf5/lib", + "PYTHONPATH=$installDir/lib/python3.7/site-packages", + "CMAKE_PREFIX_PATH=$triqsDir/lib/cmake/triqs"]) { deleteDir() /* note: this is installing into the parent (triqs) venv (install dir), which is thus shared among apps and so not be completely safe */ - sh "pip3 install -r $srcDir/requirements.txt" - sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir" + sh "pip3 install -U -r $srcDir/requirements.txt" + sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir -DBuild_Deps=Always" sh "make -j2" catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { try { sh "make test CTEST_OUTPUT_ON_FAILURE=1" From c99d08cbc00f2240c466b30c9a9483399c86c52a Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Mon, 15 Jun 2020 10:27:45 -0400 Subject: [PATCH 13/32] [jenkins] more alignment with triqs --- Jenkinsfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 754e16a..3d7ff1e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,6 +67,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) { /* install real branches in a fixed predictable place so apps can find them */ def installDir = keepInstall ? "${env.HOME}/install/${projectName}/${env.BRANCH_NAME}/${platform}" : "$tmpDir/install" def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}" + def venv = triqsDir dir(installDir) { deleteDir() } @@ -75,14 +76,14 @@ for (int i = 0; i < osxPlatforms.size(); i++) { def hdf5 = "${env.BREW}/opt/hdf5@1.10" dir(buildDir) { withEnv(platformEnv[1].collect { it.replace('\$BREW', env.BREW) } + [ - "PATH=$triqsDir/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin", + "PATH=$venv/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin", "HDF5_ROOT=$hdf5", "C_INCLUDE_PATH=$hdf5/include:${env.BREW}/include", - "CPLUS_INCLUDE_PATH=$triqsDir/include:$hdf5/include:${env.BREW}/include", - "LIBRARY_PATH=$triqsDir/lib:$hdf5/lib:${env.BREW}/lib", + "CPLUS_INCLUDE_PATH=$venv/include:$hdf5/include:${env.BREW}/include", + "LIBRARY_PATH=$venv/lib:$hdf5/lib:${env.BREW}/lib", "LD_LIBRARY_PATH=$hdf5/lib", "PYTHONPATH=$installDir/lib/python3.7/site-packages", - "CMAKE_PREFIX_PATH=$triqsDir/lib/cmake/triqs"]) { + "CMAKE_PREFIX_PATH=$venv/lib/cmake/triqs"]) { deleteDir() /* note: this is installing into the parent (triqs) venv (install dir), which is thus shared among apps and so not be completely safe */ sh "pip3 install -U -r $srcDir/requirements.txt" From fe53a65b5f009aa23271d5170b8dc50cdea3b276 Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Mon, 15 Jun 2020 10:35:10 -0400 Subject: [PATCH 14/32] [jenkins] align Dockerfile to triqs, too --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 53b08de..99350f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ WORKDIR $BUILD/$APPNAME RUN chown build . USER build ARG BUILD_DOC=0 -RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} && make -j2 || make -j1 VERBOSE=1 +ARG BUILD_ID +RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} -DBuild_Deps=Always && make -j2 || make -j1 VERBOSE=1 USER root RUN make install From 853ebf2d6a0674f607be7076492847e3e73b8d11 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Thu, 18 Jun 2020 13:58:55 -0400 Subject: [PATCH 15/32] [cmake] No longer add '-Og' for debug builds --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e42c001..1438549 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,10 +93,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Global compiler options option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF) -add_compile_options( - $<$:-Og> - $<$:-ggdb3> -) +add_compile_options($<$:-ggdb3>) # Create an Interface target for compiler warnings add_library(${PROJECT_NAME}_warnings INTERFACE) From 81096e417e994e17a8c00340998b294de452af5b Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Thu, 18 Jun 2020 17:10:15 -0400 Subject: [PATCH 16/32] [cmake] Properly set PATH environment for c++2rst custom command --- doc/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index efd0c2c..bde5a81 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -14,7 +14,8 @@ macro(generate_docs header_file) COMMAND rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated COMMAND PYTHONPATH=${CPP2PY_BINARY_DIR}:$ENV{PYTHONPATH} - ${CPP2PY_BINARY_DIR}/bin/c++2rst + PATH=${CPP2PY_BINARY_DIR}/bin:${CPP2PY_ROOT}/bin:$ENV{PATH} + c++2rst ${header_file} -N ${PROJECT_NAME} --output_directory ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated From dd33a61cc6d0094d45a52ec37d9dc696e1b9158d Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 24 Jun 2020 08:57:44 -0400 Subject: [PATCH 17/32] [cmake] When searching dependency sources, check both current dir and CMAKE_SOURCE_DIR/deps --- deps/CMakeLists.txt | 3 ++- deps/external_dependency.cmake | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 25c4996..9ac4975 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -17,7 +17,8 @@ include(external_dependency.cmake) # to locate the package in the system. # Skip this step if Build_Deps option is set. # 2. Try to find a directory containing the sources -# at ${PROJECT_SOURCE_DIR}/deps/name. If found +# at ${CMAKE_CURRENT_SOURCE_DIR}/name and +# ${CMAKE_SOURCE_DIR}/deps/name. If found # build it as a cmake sub-project. # 3. If GIT_REPO is provided, git clone the sources, # and build them as a cmake sub-project. diff --git a/deps/external_dependency.cmake b/deps/external_dependency.cmake index e7cc44e..7ba1b7a 100644 --- a/deps/external_dependency.cmake +++ b/deps/external_dependency.cmake @@ -51,6 +51,9 @@ function(external_dependency) if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}) message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}") add_subdirectory(${ARGV0} ${subdir_opts}) + elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/deps/${ARGV0}) + message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_SOURCE_DIR}/deps/${ARGV0}") + add_subdirectory(${ARGV0} ${subdir_opts}) elseif(ARG_GIT_REPO) set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0}) set(src_dir ${bin_dir}_src) From 6aff3f1a39f121690785d086c9a7ae33b2f625de Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 24 Jun 2020 10:06:11 -0400 Subject: [PATCH 18/32] [cmake] Default to -DBuild_Deps=IfNotFound, adjust install instructions --- deps/CMakeLists.txt | 2 +- doc/install.rst | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 9ac4975..dad295f 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -35,7 +35,7 @@ include(external_dependency.cmake) # In particular the dependency will not be installed. if(NOT DEFINED Build_Deps) - set(Build_Deps "Never" CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]") + set(Build_Deps "IfNotFound" CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]") else() set(Build_Deps_Opts "Never" "Always" "IfNotFound") if(NOT ${Build_Deps} IN_LIST Build_Deps_Opts) diff --git a/doc/install.rst b/doc/install.rst index 203ab7c..d8668c5 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -19,13 +19,6 @@ Installation steps $ git clone https://github.com/TRIQS/app4triqs app4triqs.src -#. Make sure that all additional dependencies are installed on your system and available in your environment. - Alternatively build the dependencies from source instead with:: - - $ (cd deps && ./download.sh) - - In this case they will be installed together with your application. - #. Create and move to a new directory where you will compile the code:: $ mkdir app4triqs.build && cd app4triqs.build From 15e4c6d6352c314b8ed011db482122003601bc2a Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 24 Jun 2020 10:13:02 -0400 Subject: [PATCH 19/32] [cmake] Provide information on INSTALL_PREFIX in config.cmake files --- share/cmake/app4triqs-config.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/cmake/app4triqs-config.cmake.in b/share/cmake/app4triqs-config.cmake.in index e910132..452a7d7 100644 --- a/share/cmake/app4triqs-config.cmake.in +++ b/share/cmake/app4triqs-config.cmake.in @@ -21,7 +21,7 @@ set(@PROJECT_NAME@_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "@PROJECT_NAME@ root # Include the exported targets of this project include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake) -message(STATUS "Found @PROJECT_NAME@-config.cmake with version @PROJECT_VERSION@, hash = @PROJECT_GIT_HASH@") +message(STATUS "Found @PROJECT_NAME@-config.cmake with version @PROJECT_VERSION@, hash = @PROJECT_GIT_HASH@, root = @CMAKE_INSTALL_PREFIX@") # Was the Project built with Documentation? set(@PROJECT_NAME@_WITH_DOCUMENTATION @Build_Documentation@ CACHE BOOL "Was @PROJECT_NAME@ build with documentation?") From c04128fa0d2b4d9022e322b3bdba768641069639 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 8 Jul 2020 11:25:57 -0400 Subject: [PATCH 20/32] [cmake] Protect against flags -I/usr/include in extract_flags.cmake --- share/cmake/extract_flags.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/cmake/extract_flags.cmake b/share/cmake/extract_flags.cmake index dfcf67b..6bce43c 100644 --- a/share/cmake/extract_flags.cmake +++ b/share/cmake/extract_flags.cmake @@ -76,10 +76,14 @@ macro(extract_flags) list(REMOVE_ITEM sys_inc_dirs ${inc_dirs}) endif() foreach(dir ${inc_dirs}) - set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -I${dir}") + if(NOT dir STREQUAL "/usr/include") + set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -I${dir}") + endif() endforeach() foreach(dir ${sys_inc_dirs}) - set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -isystem${dir}") + if(NOT dir STREQUAL "/usr/include") + set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -isystem${dir}") + endif() endforeach() get_property_recursive(libs TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES) From e2f4e9988e66b52463305b84d5878b692393c67e Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Tue, 14 Jul 2020 18:29:12 -0400 Subject: [PATCH 21/32] [cmake] Extend extract_flags.cmake to treat compiler-specific generator expressions properly --- share/cmake/extract_flags.cmake | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/share/cmake/extract_flags.cmake b/share/cmake/extract_flags.cmake index 6bce43c..b6d1148 100644 --- a/share/cmake/extract_flags.cmake +++ b/share/cmake/extract_flags.cmake @@ -93,7 +93,8 @@ macro(extract_flags) endif() endforeach() - # We have to replace generator expressions explicitly + # ==== We have to replace generator expressions explicitly ==== + if(ARG_BUILD_INTERFACE) string(REGEX REPLACE "\\$" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}") string(REGEX REPLACE "\\$" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}") @@ -101,6 +102,19 @@ macro(extract_flags) string(REGEX REPLACE "\\$" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}") string(REGEX REPLACE "\\$" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}") endif() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + string(REGEX REPLACE "\\$<\\$:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}") + string(REGEX REPLACE "\\$<\\$:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + string(REGEX REPLACE "\\$<\\$:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}") + string(REGEX REPLACE "\\$<\\$:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + string(REGEX REPLACE "\\$<\\$:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}") + string(REGEX REPLACE "\\$<\\$:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}") + endif() + + # Remove all remaining generator expressions string(REGEX REPLACE " [^ ]*\\$<[^ ]*:[^>]*>" "" ${target}_LDFLAGS "${${target}_LDFLAGS}") string(REGEX REPLACE " [^ ]*\\$<[^ ]*:[^>]*>" "" ${target}_CXXFLAGS "${${target}_CXXFLAGS}") endmacro() From 5a9fc1118b0ad371bc351cca7f597432780f95c6 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Tue, 14 Jul 2020 18:29:39 -0400 Subject: [PATCH 22/32] [cmake] In extract_flags.cmake, protect extraction of -L/usr/lib and fix filtering -I/usr/include --- share/cmake/extract_flags.cmake | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/share/cmake/extract_flags.cmake b/share/cmake/extract_flags.cmake index b6d1148..e00ee62 100644 --- a/share/cmake/extract_flags.cmake +++ b/share/cmake/extract_flags.cmake @@ -76,14 +76,10 @@ macro(extract_flags) list(REMOVE_ITEM sys_inc_dirs ${inc_dirs}) endif() foreach(dir ${inc_dirs}) - if(NOT dir STREQUAL "/usr/include") - set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -I${dir}") - endif() + set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -I${dir}") endforeach() foreach(dir ${sys_inc_dirs}) - if(NOT dir STREQUAL "/usr/include") - set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -isystem${dir}") - endif() + set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -isystem${dir}") endforeach() get_property_recursive(libs TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES) @@ -117,4 +113,10 @@ macro(extract_flags) # Remove all remaining generator expressions string(REGEX REPLACE " [^ ]*\\$<[^ ]*:[^>]*>" "" ${target}_LDFLAGS "${${target}_LDFLAGS}") string(REGEX REPLACE " [^ ]*\\$<[^ ]*:[^>]*>" "" ${target}_CXXFLAGS "${${target}_CXXFLAGS}") + + # Filter out system directories from LDFLAGS and CXXFLAGS + string(REGEX REPLACE " -L/usr/lib " " " ${target}_LDFLAGS "${${target}_LDFLAGS}") + string(REGEX REPLACE " -I/usr/include " " " ${target}_CXXFLAGS "${${target}_CXXFLAGS}") + string(REGEX REPLACE " -isystem/usr/include " " " ${target}_CXXFLAGS "${${target}_CXXFLAGS}") + endmacro() From 9c23827e01589f2925e234868da8a98b339d6b9d Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 27 Jul 2020 15:25:32 -0400 Subject: [PATCH 23/32] [doc] Add missing theme images --- doc/themes/agogo/static/bgfooter.png | Bin 0 -> 434 bytes doc/themes/agogo/static/bgtop.png | Bin 0 -> 430 bytes doc/themes/triqs/static/bodybg.png | Bin 0 -> 602 bytes doc/themes/triqs/static/footerbg.png | Bin 0 -> 313 bytes doc/themes/triqs/static/headerbg.png | Bin 0 -> 344 bytes doc/themes/triqs/static/listitem.png | Bin 0 -> 207 bytes doc/themes/triqs/static/relbg.png | Bin 0 -> 332 bytes 7 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/themes/agogo/static/bgfooter.png create mode 100644 doc/themes/agogo/static/bgtop.png create mode 100644 doc/themes/triqs/static/bodybg.png create mode 100644 doc/themes/triqs/static/footerbg.png create mode 100644 doc/themes/triqs/static/headerbg.png create mode 100644 doc/themes/triqs/static/listitem.png create mode 100644 doc/themes/triqs/static/relbg.png diff --git a/doc/themes/agogo/static/bgfooter.png b/doc/themes/agogo/static/bgfooter.png new file mode 100644 index 0000000000000000000000000000000000000000..9ce5bdd902943fdf8b0c0ca6a545297e1e2cc665 GIT binary patch literal 434 zcmV;j0ZsmiP)Px#24YJ`L;%wO*8tD73qoQ5000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXD> z2Q(2CT#42I000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0003ENklR?sq9~H`=l5UI-{JW_f9!)=Hwush3JC}Y z1gFM&r>$lJNPt^*1k!w;l|obx>lr$2IOaI$n=(gBBaj^I0=y%@K5N&GIU&-%OE_~V zX=m=_j7d`hvubQRuF+xT63vIfWnC3%kKN*T3l7ob3nEC2R->wU1Y)4)(7_t^thiqb zj$CO7xBn9gg`*!MY$}SI|_*)!a*&V0w7h>cUb&$Grh37iJ=C%Yn c>}w1E0Z4f>1OEiDlmGw#07*qoM6N<$g4BwtIsgCw literal 0 HcmV?d00001 diff --git a/doc/themes/agogo/static/bgtop.png b/doc/themes/agogo/static/bgtop.png new file mode 100644 index 0000000000000000000000000000000000000000..a0d4709bac8f79943a817195c086461c8c4d5419 GIT binary patch literal 430 zcmV;f0a5;mP)Px#24YJ`L;zI)R{&FzA;Z4_000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXD> z2Q3AZhV-)l000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0003ANklMo8vqN`cM=KwSQV|n zk}naE+VzlN;kK@Ej${PSkI$-R6-Yfp`zA;^O$`)7`gRi{-0i?owGIbX{p>Nc##93U z;sA|ayOYkG%F9M0iEMUM*s3NDYSS=KN2ht8Rv|7nv77i{NTO47R)}V_+2H~mL-nTR z_8j}*%6Qm8?#7NU2kM$#gcP&kO?iw|n}ynz+r-~FA9nKcZnfixWvZ&d28Cc_6&_Pe zMpbjI>9r+<=}NIDz4mCd3U++H?rrHcYxH&eeB|)>mnv*N#44ILM2zL6yU!VVWSrgp Y0Yu&#qm)=by8r+H07*qoM6N<$f@HC)j{pDw literal 0 HcmV?d00001 diff --git a/doc/themes/triqs/static/bodybg.png b/doc/themes/triqs/static/bodybg.png new file mode 100644 index 0000000000000000000000000000000000000000..506b6f908b346569a405118042adcb5db9fb59d3 GIT binary patch literal 602 zcmV-g0;TC1q*fe@n4#zaZ?&yk{Pg#&{Xy2CBNQ>%&e-+xAnMpv*ngq{Yp02t8n}`i8jjEKY*^cXXY{O zlvqRJrK(`I&QecRHo;4L?3|K%;w7(12#~EORd`4xJxNt{*kqnilB5|iZ0uZgjEK%b z)w#xbjxj=-QrK73Rh1C!4>V|(6f0;o2uL%Q41W4Pp2U|b-=$hM*L7d-=F90}_z(Ex oiKLl%?=@rxd|N}U-+$K7UroZ0lrV;)AOHXW07*qoM6N<$f)b?!!T zStD}VgsY}*S8{)cY|s5E@lW=1_Qve`>w9F9_U3-h-^Tn*!*t`hZ6H=!O@QAMW#`%r zQCFfiu$_5aXm50deYNXb(KUjbU-QI1fB!%6&(p&{7=;g?6nRsmascQ@22WQ%mvv4F FO#mA*ghBuS literal 0 HcmV?d00001 diff --git a/doc/themes/triqs/static/headerbg.png b/doc/themes/triqs/static/headerbg.png new file mode 100644 index 0000000000000000000000000000000000000000..6d3e1d5e651326bf0315d05da96aedfe55b257e9 GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1SFYWcSQjy&H|6fVxatW5N34Jm|X!BWH0gb zb!ETH$S0;{@^ZgSFHq>ar;B5V#p$<`9rF$=2)N#FFBB1xU)}!l@6!$qvzdB6oSg4g z1%;<3&V0zZSF*O`-;aJU@DxD`=Le`hnB0DjDSsgXeG@Jbi4RlYsDn#}C*1 z?qBrQJ%5Jg**LTF;RO>exn4YA8($uBaf;poL1O_1zPS9gqH)^nGivj%)c)Oiq9Fh1 zna@rfUel{~-Thm~ykWB6^IJ9huGz&Ke%{pOdGVFR`|Vb5FYol5ef2b(T~h7&l5JL- zYLEM5)^&Z|c6R?wz8RW+zH2t;{xi8P$o(g2=Jc;K7urSWX6Z&Sr_Gx_ZJ{2Jy(OV{ o2CwkH%oFT4{vZBvy8R>T@984ky))J?1qK0wr>mdKI;Vst0L~YZ=>Px# literal 0 HcmV?d00001 diff --git a/doc/themes/triqs/static/listitem.png b/doc/themes/triqs/static/listitem.png new file mode 100644 index 0000000000000000000000000000000000000000..e45715f914df0b9ce5650cd81f826565d794bc6f GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRO!3HEZ#7tid5-9M9ECz~A24Tjhjus6-LG}_) zUsv|KjDqY+yxD&zFaw41JY5_^BrYc>NGv&UGh(5%v^3ic2_Tqf;9+ScrKuZn^uU2H zQyfn*9&-yU`CQ%jRM<_jbEVs=+4%-On`#az=vrO%C^ha<()jUzeq*EHImaYp10cwd vh@M+!5EQwitFh7Z?ulO_J-(9;uViOPP?5c=x_{|>pv?@Pu6{1-oD!M<&SgTz literal 0 HcmV?d00001 diff --git a/doc/themes/triqs/static/relbg.png b/doc/themes/triqs/static/relbg.png new file mode 100644 index 0000000000000000000000000000000000000000..47225851b87028b3b18e4ca7e0162984a3643595 GIT binary patch literal 332 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1SFYWcSQjy&H|6fVxatW5N34Jm|X!BWH0gb zb!ETH$S>#XorPwP2Z@rO!1+&>XXC$7MK3nOVpPe b)G_S-&Gh)gjM8kNw;4QL{an^LB{Ts5zWs(2 literal 0 HcmV?d00001 From 56483b2d7d2bf3c95a90ddc0d70a8cdb549ae203 Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Mon, 3 Aug 2020 11:23:34 -0400 Subject: [PATCH 24/32] [jenkins] send email on test failure too --- Jenkinsfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3d7ff1e..bab8d5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -102,6 +102,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) { } /****************** wrap-up */ +def error = null try { parallel platforms if (keepInstall) { node("docker") { @@ -150,13 +151,13 @@ try { } } } } } catch (err) { + error = err +} finally { /* send email on build failure (declarative pipeline's post section would work better) */ - if (env.BRANCH_NAME != "jenkins") emailext( + if ((error != null || currentBuild.currentResult != 'SUCCESS') && env.BRANCH_NAME != "jenkins") emailext( subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED", body: """\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED -$err - Check console output at \$BUILD_URL to view full results. Building \$BRANCH_NAME for \$CAUSE @@ -168,11 +169,11 @@ Changes: End of build log: \${BUILD_LOG,maxLines=60} """, - to: 'nwentzell@flatironinstitute.org', + to: 'nwentzell@flatironinstitute.org, dsimon@flatironinstitute.org', recipientProviders: [ [$class: 'DevelopersRecipientProvider'], ], replyTo: '$DEFAULT_REPLYTO' ) - throw err + if (error != null) throw error } From ff8124ea24cc75146f048d1f81bb489426e12d1a Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Mon, 3 Aug 2020 11:25:11 -0400 Subject: [PATCH 25/32] [jenkins] inject test failure to test email --- test/python/Basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/python/Basic.py b/test/python/Basic.py index 9ff46e2..4c90ad1 100644 --- a/test/python/Basic.py +++ b/test/python/Basic.py @@ -14,7 +14,7 @@ def test_add(self): b=Toto(2) c=a+b - self.assertEqual(c, b) + self.assertEqual(c, a) def test_h5(self): From 1eabf195704742d07b619a5808ad4abbded5cc51 Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Mon, 3 Aug 2020 11:32:27 -0400 Subject: [PATCH 26/32] Revert "[jenkins] inject test failure to test email" This reverts commit ff8124ea24cc75146f048d1f81bb489426e12d1a. --- test/python/Basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/python/Basic.py b/test/python/Basic.py index 4c90ad1..9ff46e2 100644 --- a/test/python/Basic.py +++ b/test/python/Basic.py @@ -14,7 +14,7 @@ def test_add(self): b=Toto(2) c=a+b - self.assertEqual(c, a) + self.assertEqual(c, b) def test_h5(self): From 43720b8f8f608748289b0bae118014138d0b5a57 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 3 Aug 2020 15:34:31 -0400 Subject: [PATCH 27/32] [cmake] Use find_package over find_dependency in config.cmake.in to improve cmake version compatibility --- share/cmake/app4triqs-config.cmake.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/cmake/app4triqs-config.cmake.in b/share/cmake/app4triqs-config.cmake.in index 452a7d7..ef926ef 100644 --- a/share/cmake/app4triqs-config.cmake.in +++ b/share/cmake/app4triqs-config.cmake.in @@ -15,8 +15,7 @@ set(@PROJECT_NAME@_GIT_HASH @PROJECT_GIT_HASH@ CACHE STRING "@PROJECT_NAME@ git set(@PROJECT_NAME@_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "@PROJECT_NAME@ root directory") ## Find the target dependencies -#include(CMakeFindDependencyMacro) -#find_dependency(... HINTS @CMAKE_INSTALL_PREFIX@) +#find_package(... REQUIRED HINTS @CMAKE_INSTALL_PREFIX@) # Include the exported targets of this project include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake) From eb68c32562daa0a4b496af1c84be9a806ff90815 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 3 Aug 2020 15:38:56 -0400 Subject: [PATCH 28/32] Update changelog for app4triqs 3.0.0 release --- doc/ChangeLog.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index c71910b..99deae8 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -1,7 +1,17 @@ +Version 3.0.0 +============= + +app4triqs version 3.0.0 is a compatibility +release for TRIQS version 3.0.0 that +* introduces compatibility with Python 3 (Python 2 no longer supported) +* adds a cmake-based dependency management +* fixes several application issues + + Version 2.2.0 -------------- +============= -App4triqs Version 2.2.0 provides a project +app4triqs Version 2.2.0 provides a project skeleton for TRIQS applications based on the TRIQS Library Version 2.2.0. It is intended for applications with both From 7047ac8373f74b81798f72da2852a17ba9c37d9e Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Thu, 6 Aug 2020 13:36:09 -0400 Subject: [PATCH 29/32] Add template for conda packaging --- packaging/conda/build.sh | 22 ++++++++++ packaging/conda/conda_build_config.yaml | 3 ++ packaging/conda/meta.yaml | 57 +++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 packaging/conda/build.sh create mode 100644 packaging/conda/conda_build_config.yaml create mode 100644 packaging/conda/meta.yaml diff --git a/packaging/conda/build.sh b/packaging/conda/build.sh new file mode 100644 index 0000000..e3d1f54 --- /dev/null +++ b/packaging/conda/build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +mkdir build +cd build + +# Openmpi Specific environment setup - Cf. https://github.com/conda-forge/libnetcdf-feedstock/pull/80 +export OMPI_MCA_btl=self,tcp +export OMPI_MCA_plm=isolated +export OMPI_MCA_rmaps_base_oversubscribe=yes +export OMPI_MCA_btl_vader_single_copy_mechanism=none +mpiexec="mpiexec --allow-run-as-root" + +source $PREFIX/share/triqsvars.sh + +cmake \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_BUILD_TYPE=Release \ + .. + +make -j${CPU_COUNT} VERBOSE=1 +CTEST_OUTPUT_ON_FAILURE=1 ctest +make install diff --git a/packaging/conda/conda_build_config.yaml b/packaging/conda/conda_build_config.yaml new file mode 100644 index 0000000..289631f --- /dev/null +++ b/packaging/conda/conda_build_config.yaml @@ -0,0 +1,3 @@ +mpi: + - mpich + - openmpi diff --git a/packaging/conda/meta.yaml b/packaging/conda/meta.yaml new file mode 100644 index 0000000..2fd369e --- /dev/null +++ b/packaging/conda/meta.yaml @@ -0,0 +1,57 @@ +{% set version = "3.0.0" %} + +package: + name: app4triqs + version: {{ version }} + +source: + url: https://github.com/TRIQS/app4triqs/releases/download/{{ version }}/app4triqs-{{ version }}.tar.gz + sha256: PUT HERE THE SHA256 OF YOUR RELEASE TARBALL + +build: + number: 0 + skip: True # [win or py<30] + +requirements: + build: + - cmake + - make + - {{ compiler('c') }} + - {{ compiler('cxx') }} + host: + - triqs {{ '.'.join(version.split('.')[:2]) }} + - boost-cpp + - hdf5 + - {{ mpi }} + - libblas + - liblapack + - python + run: + - {{ pin_compatible("triqs", max_pin="x.x") }} + - boost-cpp + - hdf5 + - {{ mpi }} + - libblas + - liblapack + - python + +test: + commands: + - export OMPI_MCA_btl=self,tcp + - export OMPI_MCA_plm=isolated + - export OMPI_MCA_rmaps_base_oversubscribe=yes + - export OMPI_MCA_btl_vader_single_copy_mechanism=none + - export mpiexec="mpiexec --allow-run-as-root" + - python -c "import app4triqs" + +about: + home: https://triqs.github.io/app4triqs + license: GPL-3.0-or-later + license_family: GPL + license_file: LICENSE.txt + summary: 'An application based on the TRIQS library' + +extra: + recipe-maintainers: + - wentzell + - pgunn From abdc51ca9410253180786feeedd633dca71e2d30 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Thu, 6 Aug 2020 13:39:09 -0400 Subject: [PATCH 30/32] Add template easybuild script --- ...app4triqs-3.0.0-foss-2019a-Python-3.7.2.eb | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 packaging/TRIQS-app4triqs-3.0.0-foss-2019a-Python-3.7.2.eb diff --git a/packaging/TRIQS-app4triqs-3.0.0-foss-2019a-Python-3.7.2.eb b/packaging/TRIQS-app4triqs-3.0.0-foss-2019a-Python-3.7.2.eb new file mode 100644 index 0000000..e467ccb --- /dev/null +++ b/packaging/TRIQS-app4triqs-3.0.0-foss-2019a-Python-3.7.2.eb @@ -0,0 +1,65 @@ +easyblock = 'CMakeMake' + +name = 'TRIQS-app4triqs' +version = '3.0.0' +versionsuffix = '-Python-%(pyver)s' + +homepage = 'https://triqs.github.io/app4triqs/' +description = """ + TRIQS (Toolbox for Research on Interacting Quantum Systems) is a + scientific project providing a set of C++ and Python libraries to + develop new tools for the study of interacting quantum systems. + + PROVIDE HERE A DESCRIPTION OF YOUR APPLICATION +""" + +docurls = ['https://triqs.github.io/app4triqs/%(version_major_minor)s.x/'] +software_license = 'LicenseGPLv3' + +toolchain = {'name': 'foss', 'version': '2019a'} +toolchainopts = {'pic': True, 'usempi': True} + +source_urls = ['https://github.com/TRIQS/app4triqs/releases/download/%(version)s/'] +sources = ['app4triqs-%(version)s.tar.gz'] +checksums = ['PUT HERE THE SHA256 OF THE RELEASE TARBALL'] + +dependencies = [ + ('Python', '3.7.2'), + ('SciPy-bundle', '2019.03'), + ('Boost', '1.70.0'), + ('Clang', '8.0.0'), + ('GMP', '6.1.2'), + ('HDF5', '1.10.5'), + ('Mako', '1.0.8'), + ('h5py', '2.9.0'), + ('TRIQS', '3.0.0', versionsuffix), + ('NFFT', '3.5.1') +] + +builddependencies = [ + ('CMake', '3.13.3') +] + +separate_build_dir = True + +runtest = 'test' + +sanity_check_paths = { + 'files': ['lib/libapp4triqs_c.a'], + 'dirs': ['include', 'include/app4triqs', 'lib', + 'lib/python%(pyshortver)s/site-packages', 'share'], +} + +sanity_check_commands = ["python -c 'import app4triqs'"] + +modextrapaths = { + 'CPLUS_INCLUDE_PATH': 'include', + 'PYTHONPATH': 'lib/python%(pyshortver)s/site-packages', + 'CMAKE_PREFIX_PATH': 'lib/cmake/app4triqs', +} +modextravars = { + 'APP4TRIQS_ROOT': '%(installdir)s', + 'APP4TRIQS_VERSION': '%(version)s', +} + +moduleclass = 'phys' From 01797357c7da230187b7fb5d9109be41f46e7912 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 15 Jun 2020 11:53:24 -0400 Subject: [PATCH 31/32] Make app4triqs not depend on triqs Co-authored-by: Dylan Simon --- .travis.yml | 12 +-- CMakeLists.txt | 40 ++++---- Dockerfile | 16 ---- Dockerfile.build | 24 +++++ Jenkinsfile | 15 +-- c++/app4triqs/CMakeLists.txt | 12 ++- c++/app4triqs/app4triqs.hpp | 1 - deps/CMakeLists.txt | 6 ++ doc/CMakeLists.txt | 3 +- doc/conf.py.in | 6 +- doc/index.rst | 2 +- doc/install.rst | 19 +--- packaging/Dockerfile.centos-gcc | 38 ++++++++ packaging/Dockerfile.msan | 107 ++++++++++++++++++++++ packaging/Dockerfile.ubuntu-clang | 41 +++++++++ packaging/Dockerfile.ubuntu-gcc | 32 +++++++ packaging/conda/meta.yaml | 4 - python/app4triqs/CMakeLists.txt | 6 +- python/app4triqs/app4triqs_module_desc.py | 2 +- python/app4triqs/version.py.in | 3 +- requirements.txt | 3 + share/CMakeLists.txt | 4 +- share/app4triqs.modulefile.in | 4 - share/cmake/Modules/Findsanitizer.cmake | 97 ++++++++++++++++++++ test/Dockerfile.msan | 68 ++++++++++++++ test/c++/basic.cpp | 2 +- test/python/Basic.py | 18 +--- test/python/CMakeLists.txt | 4 +- 28 files changed, 477 insertions(+), 112 deletions(-) delete mode 100644 Dockerfile create mode 100644 Dockerfile.build create mode 100644 packaging/Dockerfile.centos-gcc create mode 100644 packaging/Dockerfile.msan create mode 100644 packaging/Dockerfile.ubuntu-clang create mode 100644 packaging/Dockerfile.ubuntu-gcc create mode 100644 share/cmake/Modules/Findsanitizer.cmake create mode 100644 test/Dockerfile.msan diff --git a/.travis.yml b/.travis.yml index 7e3b6f8..87303c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,17 +15,17 @@ install: true script: - export INSTALL_DIR=$HOME/root_install # We install outside the repository - # ===== Set up TRIQS + # ===== Set up CPP2PY - cd $TRAVIS_BUILD_DIR - - git clone https://github.com/TRIQS/triqs --branch unstable - - mkdir triqs/build && cd triqs/build - - cmake .. -DBuild_Tests=OFF -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR + - git clone https://github.com/TRIQS/cpp2py + - mkdir cpp2py/build && cd cpp2py/build + - cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR - make -j2 install - - source $INSTALL_DIR/share/triqsvars.sh + - source $INSTALL_DIR/share/cpp2pyvars.sh # ===== Set up app4triqs and test - cd $TRAVIS_BUILD_DIR - mkdir build && cd build - - cmake .. -DASAN=ON -DUBSAN=ON + - cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DASAN=ON -DUBSAN=ON - export UBSAN_SYMBOLIZER_PATH=$(which llvm-symbolizer) - export ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer) - export UBSAN_OPTIONS=symbolize=1:print_stacktrace=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1438549..89820f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,25 +33,14 @@ endif() project(app4triqs VERSION 3.0.0 LANGUAGES C CXX) get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY) -# ############ -# Load TRIQS and CPP2PY -find_package(TRIQS 3.0 REQUIRED) - # Get the git hash & print status -triqs_get_git_hash_of_source_dir(PROJECT_GIT_HASH) +execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE PROJECT_GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS "${PROJECT_NAME} version : ${PROJECT_VERSION}") message(STATUS "${PROJECT_NAME} Git hash: ${PROJECT_GIT_HASH}") -# Enforce Consistent Versioning -if(NOT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} VERSION_EQUAL ${TRIQS_VERSION_MAJOR}.${TRIQS_VERSION_MINOR}) - message(FATAL_ERROR "The ${PROJECT_NAME} version ${PROJECT_VERSION} is not compatible with TRIQS version ${TRIQS_VERSION}.") -endif() - -# Default Install directory to TRIQS_ROOT if not given or invalid. +# Assert that Install directory is given and invalid. if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})) - message(STATUS "No install prefix given (or invalid). Defaulting to TRIQS_ROOT") - set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE) - set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE) + message(FATAL_ERROR "No install prefix given (or invalid)") endif() if(NOT IS_SUBPROJECT) message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------") @@ -75,9 +64,6 @@ endif() # Python Support option(PythonSupport "Build with Python support" ON) -if(PythonSupport AND NOT TRIQS_WITH_PYTHON_SUPPORT) - message(FATAL_ERROR "TRIQS was installed without Python support. Cannot build the Python Interface. Disable the build with -DPythonSupport=OFF") -endif() # Documentation option(Build_Documentation "Build documentation" OFF) @@ -111,6 +97,25 @@ target_compile_options(${PROJECT_NAME}_warnings $<$:-Wno-gcc-compat> ) +# --------------------------------- +# Resolve Clang Linktime Problems +# CMake will adjust any linker flags from '-L path_to/mylib.so' to -lmylib +# if the proper mylib.so is automatically found by the linker, i.e. +# the directory comes first in LIBRARY_PATH. +# The clang linker however ignores LIBRARY_PATH. +# We thus explicitly add the content of LIBRARY_PATH to the LDFLAGS +# FIXME For future cmake versions we should populate the +# INTERFACE_LINK_DIRECTORIES of the triqs target +# --------------------------------- +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND DEFINED ENV{LIBRARY_PATH}) + string(REPLACE ":" ";" LINK_DIRS $ENV{LIBRARY_PATH}) + foreach(dir ${LINK_DIRS}) + string(APPEND CMAKE_SHARED_LINKER_FLAGS " -L${dir}") + string(APPEND CMAKE_MODULE_LINKER_FLAGS " -L${dir}") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -L${dir}") + endforeach() +endif() + # ############# # Build Project @@ -151,7 +156,6 @@ if(BUILD_DEBIAN_PACKAGE AND NOT IS_SUBPROJECT) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/${PROJECT_NAME}") execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 3.0)") set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) include(CPack) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 99350f0..0000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# See ../triqs/packaging for other options -FROM flatironinstitute/triqs:unstable-ubuntu-clang -ARG APPNAME=app4triqs - -COPY requirements.txt /src/$APPNAME/requirements.txt -RUN pip3 install -r /src/$APPNAME/requirements.txt - -COPY --chown=build . $SRC/$APPNAME -WORKDIR $BUILD/$APPNAME -RUN chown build . -USER build -ARG BUILD_DOC=0 -ARG BUILD_ID -RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} -DBuild_Deps=Always && make -j2 || make -j1 VERBOSE=1 -USER root -RUN make install diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..33c84f6 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,24 @@ +# See packaging for various base options +FROM flatironinstitute/triqs:base +ARG APPNAME=app4triqs + +COPY requirements.txt /src/$APPNAME/requirements.txt +RUN pip3 install -r /src/$APPNAME/requirements.txt + +RUN useradd -u 993 -m build + +ENV SRC=/src \ + BUILD=/home/build \ + INSTALL=/usr/local \ + PYTHONPATH=/usr/local/lib/python$PYTHON_VERSION/site-packages \ + CMAKE_PREFIX_PATH=/usr/lib/cmake/$APPNAME + +COPY --chown=build . $SRC/$APPNAME +WORKDIR $BUILD/$APPNAME +RUN chown build . +USER build +ARG BUILD_DOC=0 +ARG BUILD_ID +RUN cmake $SRC/$APPNAME -DCMAKE_INSTALL_PREFIX=$INSTALL -DBuild_Documentation=$BUILD_DOC -DBuild_Deps=Always -DCLANG_OPT="$CXXFLAGS" -DMATHJAX_PATH="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2" && make -j2 || make -j1 VERBOSE=1 +USER root +RUN make install diff --git a/Jenkinsfile b/Jenkinsfile index bab8d5a..3d9cb3e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,9 +3,6 @@ def projectName = "app4triqs" /* set to app/repo name */ def dockerName = projectName.toLowerCase(); /* which platform to build documentation on */ def documentationPlatform = "ubuntu-clang" -/* depend on triqs upstream branch/project */ -def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME -def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F') /* whether to keep and publish the results */ def keepInstall = !env.BRANCH_NAME.startsWith("PR-") @@ -15,7 +12,7 @@ properties([ pipelineTriggers(keepInstall ? [ upstream( threshold: 'SUCCESS', - upstreamProjects: triqsProject + upstreamProjects: '/TRIQS/cpp2py/master,/TRIQS/h5/unstable' ) ] : []) ]) @@ -34,8 +31,7 @@ for (int i = 0; i < dockerPlatforms.size(); i++) { checkout scm /* construct a Dockerfile for this base */ sh """ - ( echo "FROM flatironinstitute/triqs:${triqsBranch}-${env.STAGE_NAME}" ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins - mv -f Dockerfile.jenkins Dockerfile + ( cat packaging/Dockerfile.${env.STAGE_NAME} ; sed '0,/^FROM /d' Dockerfile.build ) > Dockerfile """ /* build and tag */ def img = docker.build("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_DOC=${platform==documentationPlatform} --build-arg BUILD_ID=${env.BUILD_TAG} .") @@ -66,8 +62,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) { def buildDir = "$tmpDir/build" /* install real branches in a fixed predictable place so apps can find them */ def installDir = keepInstall ? "${env.HOME}/install/${projectName}/${env.BRANCH_NAME}/${platform}" : "$tmpDir/install" - def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}" - def venv = triqsDir + def venv = installDir dir(installDir) { deleteDir() } @@ -85,9 +80,9 @@ for (int i = 0; i < osxPlatforms.size(); i++) { "PYTHONPATH=$installDir/lib/python3.7/site-packages", "CMAKE_PREFIX_PATH=$venv/lib/cmake/triqs"]) { deleteDir() - /* note: this is installing into the parent (triqs) venv (install dir), which is thus shared among apps and so not be completely safe */ + sh "python3 -m venv $venv" sh "pip3 install -U -r $srcDir/requirements.txt" - sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir -DBuild_Deps=Always" + sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DBuild_Deps=Always" sh "make -j2" catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { try { sh "make test CTEST_OUTPUT_ON_FAILURE=1" diff --git a/c++/app4triqs/CMakeLists.txt b/c++/app4triqs/CMakeLists.txt index ed2b050..73df783 100644 --- a/c++/app4triqs/CMakeLists.txt +++ b/c++/app4triqs/CMakeLists.txt @@ -2,25 +2,27 @@ file(GLOB_RECURSE sources *.cpp) add_library(${PROJECT_NAME}_c ${sources}) add_library(${PROJECT_NAME}::${PROJECT_NAME}_c ALIAS ${PROJECT_NAME}_c) -# Link against triqs and enable warnings -target_link_libraries(${PROJECT_NAME}_c PUBLIC triqs PRIVATE $) +# Enable warnings +target_link_libraries(${PROJECT_NAME}_c PRIVATE $) # Configure target and compilation set_property(TARGET ${PROJECT_NAME}_c PROPERTY POSITION_INDEPENDENT_CODE ON) +target_compile_options(${PROJECT_NAME}_c PUBLIC -std=c++17) target_include_directories(${PROJECT_NAME}_c PUBLIC $) target_include_directories(${PROJECT_NAME}_c SYSTEM INTERFACE $) target_compile_definitions(${PROJECT_NAME}_c PUBLIC APP4TRIQS_GIT_HASH=${PROJECT_GIT_HASH} - TRIQS_GIT_HASH=${TRIQS_GIT_HASH} $<$:APP4TRIQS_DEBUG> - $<$:TRIQS_DEBUG> - $<$:TRIQS_ARRAYS_ENFORCE_BOUNDCHECK> ) # Install library and headers install(TARGETS ${PROJECT_NAME}_c EXPORT ${PROJECT_NAME}-targets DESTINATION lib) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h") +# ========= Additional Depdencies ========== + +# Link against HDF5 C++ Interface +target_link_libraries(${PROJECT_NAME}_c PUBLIC h5::h5_c) # ========= Static Analyzer Checks ========== diff --git a/c++/app4triqs/app4triqs.hpp b/c++/app4triqs/app4triqs.hpp index e976420..ebd4871 100644 --- a/c++/app4triqs/app4triqs.hpp +++ b/c++/app4triqs/app4triqs.hpp @@ -1,5 +1,4 @@ #pragma once -#include #include
namespace app4triqs { diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index dad295f..be17223 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -65,3 +65,9 @@ external_dependency(GTest BUILD_ALWAYS EXCLUDE_FROM_ALL ) + +# -- h5 -- +external_dependency(h5 + GIT_REPO https://github.com/TRIQS/h5 + GIT_TAG unstable +) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index bde5a81..2ca1bd4 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -37,7 +37,6 @@ foreach(example ${ExampleList}) get_filename_component(d ${example} DIRECTORY) add_executable(${PROJECT_NAME}_doc_${f} EXCLUDE_FROM_ALL ${example}) set_property(TARGET ${PROJECT_NAME}_doc_${f} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${d}) - target_link_libraries(${PROJECT_NAME}_doc_${f} triqs) add_custom_command(TARGET ${PROJECT_NAME}_doc_${f} COMMAND ${PROJECT_NAME}_doc_${f} > ${CMAKE_CURRENT_SOURCE_DIR}/${d}/${f}.output 2>/dev/null WORKING_DIRECTORY ${d} @@ -56,7 +55,7 @@ endif() add_custom_target(${PROJECT_NAME}_docs_sphinx ALL) add_custom_command( TARGET ${PROJECT_NAME}_docs_sphinx - COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html + COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:${h5_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html ) option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF) diff --git a/doc/conf.py.in b/doc/conf.py.in index 7662c9b..ffee2ff 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# TRIQS documentation build configuration file +# documentation build configuration file import sys sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext") @@ -32,7 +32,7 @@ html_theme = 'triqs' html_theme_path = ['@CMAKE_CURRENT_SOURCE_DIR@/themes'] html_show_sphinx = False html_context = {'header_title': '@PROJECT_NAME@', - 'header_subtitle': 'An example application using cpp2py and TRIQS', + 'header_subtitle': 'An example application using cpp2py', 'header_links': [['Install', 'install'], ['Documentation', 'documentation'], ['Issues', 'issues'], @@ -42,4 +42,4 @@ html_sidebars = {'index': ['sideb.html', 'searchbox.html']} htmlhelp_basename = '@PROJECT_NAME@doc' -intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)} +intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None)} diff --git a/doc/index.rst b/doc/index.rst index 16a8278..f25f916 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -8,7 +8,7 @@ app4triqs This is the homepage of app4triqs v2.2.0. For changes see the :ref:`changelog page `. -An example application using cpp2py and :ref:`TRIQS `. +An example application using cpp2py. This documentation is generated based on `rst `_ files and the comments in the sources and headers. diff --git a/doc/install.rst b/doc/install.rst index d8668c5..508f006 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -6,12 +6,6 @@ Compiling app4triqs from source =============================== -Prerequisites -------------- - -#. The :ref:`TRIQS ` library, see :ref:`TRIQS installation instruction `. - In the following, we assume that TRIQS is installed in the directory ``path_to_triqs``. - Installation steps ------------------ @@ -23,13 +17,9 @@ Installation steps $ mkdir app4triqs.build && cd app4triqs.build -#. Ensure that your shell contains the TRIQS environment variables by sourcing the ``triqsvars.sh`` file from your TRIQS installation:: - - $ source path_to_triqs/share/triqsvarsh.sh - #. In the build directory call cmake, including any additional custom CMake options, see below:: - $ cmake ../app4triqs.src + $ cmake -DCMAKE_INSTALL_PREFIX=path_to_install_dir ../app4triqs.src #. Compile the code, run the tests and install the application:: @@ -37,12 +27,9 @@ Installation steps $ make test $ make install -Version compatibility ---------------------- +Versions +-------- -Keep in mind that the version of ``app4triqs`` must be compatible with your TRIQS library version, -see :ref:`TRIQS website `. -In particular the Major and Minor Version numbers have to be the same. To use a particular version, go into the directory with the sources, and look at all available versions:: $ cd app4triqs.src && git tag diff --git a/packaging/Dockerfile.centos-gcc b/packaging/Dockerfile.centos-gcc new file mode 100644 index 0000000..25bc70b --- /dev/null +++ b/packaging/Dockerfile.centos-gcc @@ -0,0 +1,38 @@ +FROM centos:8 + +RUN dnf -y install dnf-plugins-core epel-release && \ + dnf config-manager --set-enabled PowerTools && \ + dnf -y update && \ + dnf -y install \ + blas-devel \ + boost-devel \ + cmake3 \ + fftw-devel \ + gcc-c++ \ + gcc-gfortran \ + git \ + vim \ + lldb \ + gmp-devel \ + hdf5-devel \ + lapack-devel \ + make \ + openmpi-devel \ + python3-devel \ + python3-mako \ + python3-matplotlib \ + python3-mpi4py-openmpi \ + python3-numpy \ + python3-pip \ + python3-pytz \ + python3-scipy \ + python3-virtualenv + +# for openmpi +ENV PYTHON_VERSION=3.6 \ + CC=gcc CXX=g++ \ + PATH=/usr/lib64/openmpi/bin:${PATH} \ + LD_LIBRARY_PATH=/usr/lib64/openmpi/lib \ + PKG_CONFIG_PATH=/usr/lib64/openmpi/lib/pkgconfig \ + MPI_PYTHON3_SITEARCH=/usr/lib64/python3.6/site-packages/openmpi \ + OMPI_MCA_btl=^uct diff --git a/packaging/Dockerfile.msan b/packaging/Dockerfile.msan new file mode 100644 index 0000000..cbadd07 --- /dev/null +++ b/packaging/Dockerfile.msan @@ -0,0 +1,107 @@ +FROM ubuntu:focal +ARG APPNAME=app4triqs +ARG LLVM=10 +ARG NTHREAD=10 + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + clang-${LLVM} \ + cmake \ + g++ \ + gfortran \ + git \ + vim \ + lldb-${LLVM} \ + hdf5-tools \ + libblas-dev \ + libboost-dev \ + libclang-${LLVM}-dev \ + libfftw3-dev \ + libgfortran4 \ + libgmp-dev \ + python-dev \ + python3-dev \ + python3-clang-${LLVM} \ + python3-mako \ + python3-matplotlib \ + python3-numpy \ + python3-pip \ + python3-scipy + +ENV PYTHON_VERSION=3.8 \ + CC=clang-${LLVM} CXX=clang++-${LLVM} LLVM_VERSION=${LLVM}.0.0 +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM} 60 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM} --slave /usr/bin/clang-cpp clang-cpp /usr/bin/clang-cpp-${LLVM} + +# Build libcxx with MSAN +ADD https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz /tmp/ +ADD https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz /tmp/ +RUN mkdir /tmp/build && cd /tmp/build && \ + tar -C /tmp -xf /tmp/libcxx-${LLVM_VERSION}.src.tar.xz && \ + tar -C /tmp -xf /tmp/libcxxabi-${LLVM_VERSION}.src.tar.xz && \ + cmake /tmp/libcxxabi-${LLVM_VERSION}.src -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-${LLVM} -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-${LLVM} -DLIBCXXABI_LIBCXX_PATH=/tmp/libcxx-${LLVM_VERSION}.src -DLLVM_USE_SANITIZER=MemoryWithOrigins && make -j${NTHREAD} && make install && \ + rm -rf * && \ + cmake /tmp/libcxx-${LLVM_VERSION}.src -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-${LLVM} -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-${LLVM} -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS=/tmp/libcxxabi-${LLVM_VERSION}.src/include -DLLVM_USE_SANITIZER=MemoryWithOrigins && make -j${NTHREAD} install && \ + rm -rf /tmp/libcxx* /tmp/build + +# Build Environment using MSAN +ENV CXXFLAGS="-stdlib=libc++ -fsanitize=memory -fno-omit-frame-pointer -fsanitize-recover=all -fsanitize-memory-track-origins -ggdb3" \ + CFLAGS="-fsanitize=memory -fno-omit-frame-pointer -fsanitize-recover=all -fsanitize-memory-track-origins -ggdb3" \ + LD_LIBRARY_PATH=/usr/lib/llvm-${LLVM}/lib \ + LDFLAGS="-fsanitize=memory" \ + MSAN_SYMBOLIZER_PATH=/usr/lib/llvm-${LLVM}/bin/llvm-symbolizer + +# HDF5 +ADD https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/src/CMake-hdf5-1.12.0.tar.gz /tmp/ +RUN cd /tmp && tar xf /tmp/CMake-hdf5-1.12.0.tar.gz && chmod 1777 . && \ + mkdir build && cd build && \ + cmake /tmp/CMake-hdf5-1.12.0/hdf5-1.12.0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/hdf5 && make -j${NTHREAD} && make install && \ + cd /tmp && rm -rf /tmp/CMake-hdf5-1.12.0* /tmp/build +ENV HDF5_ROOT=/opt/hdf5 + +# libevent +ADD https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz /tmp/ +RUN cd /tmp && tar xf /tmp/libevent-2.1.11-stable.tar.gz && cd libevent-2.1.11-stable && \ + ./configure --prefix=/opt/openmpi --enable-shared && make -j${NTHREAD} && make install && \ + cd /tmp && rm -rf /tmp/libevent* + +# hwloc +ADD https://download.open-mpi.org/release/hwloc/v2.2/hwloc-2.2.0.tar.bz2 /tmp/ +COPY packaging/hwloc.patch /tmp/ +RUN cd /tmp && tar xf /tmp/hwloc-2.2.0.tar.bz2 && patch -p0 -i hwloc.patch && cd hwloc-2.2.0 && \ + ./configure --prefix=/opt/openmpi --enable-shared && make -j${NTHREAD} && make install && \ + cd /tmp && rm -rf /tmp/hwloc* + +# OpenMPI +ADD https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.4.tar.bz2 /tmp/ +RUN cd /tmp && tar xf /tmp/openmpi-4.0.4.tar.bz2 && cd openmpi-4.0.4 && \ + ./configure --prefix=/opt/openmpi --enable-shared --disable-mpi-fortran --disable-pty-support --with-hwloc=/opt/openmpi --with-libevent=/opt/openmpi && make -j${NTHREAD} && make install && \ + cd /tmp && rm -rf /tmp/openmpi-4.0.4* +ENV MPI_ROOT=/opt/openmpi \ + MPICC=/opt/openmpi/bin/mpicc + +# Use libflame to provide blas / lapack +RUN git clone https://github.com/Wentzell/libflame /tmp/libflame && cd /tmp/libflame && \ + ./configure --prefix=/opt/libflame --enable-lapack2flame --enable-builtin-blas && make -j${NTHREAD} && make install && \ + cd /tmp && rm -rf /tmp/libflame + +# Dockerfile.build with sanitization enabled +COPY requirements.txt /src/$APPNAME/requirements.txt +# Install numpy first to prevent h5py from pulling in a newer version first +RUN pip3 install `grep numpy /src/$APPNAME/requirements.txt` && \ + pip3 install -r /src/$APPNAME/requirements.txt + +RUN useradd -m build + +ENV SRC=/src \ + BUILD=/home/build \ + INSTALL=/usr/local \ + PYTHONPATH=/usr/local/lib/python3.8/site-packages \ + CMAKE_PREFIX_PATH=/usr/lib/cmake/$APPNAME + +COPY . ${SRC}/$APPNAME +WORKDIR ${BUILD}/$APPNAME +RUN chown -R build . ${SRC}/$APPNAME +USER build +RUN cmake $SRC/$APPNAME -DCMAKE_INSTALL_PREFIX=$INSTALL -DBuild_Deps=Always -DCLANG_OPT="$CXXFLAGS" -DMSAN=ON \ + -DLAPACK_LIBRARIES=/opt/libflame/lib/libflame.a -DBLAS_LIBRARIES=/opt/libflame/lib/libflame.a && \ + make -j${NTHREAD} +RUN make test CTEST_OUTPUT_ON_FAILURE=1 || true diff --git a/packaging/Dockerfile.ubuntu-clang b/packaging/Dockerfile.ubuntu-clang new file mode 100644 index 0000000..4875d9b --- /dev/null +++ b/packaging/Dockerfile.ubuntu-clang @@ -0,0 +1,41 @@ +FROM ubuntu:focal +ARG LLVM=9 + +# This platform includes dependencies for building docs +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + clang-${LLVM} \ + cmake \ + g++ \ + gfortran \ + git \ + vim \ + lldb-${LLVM} \ + hdf5-tools \ + libblas-dev \ + libboost-all-dev \ + libclang-${LLVM}-dev \ + libc++-${LLVM}-dev \ + libc++abi-${LLVM}-dev \ + libfftw3-dev \ + libgfortran4 \ + libgmp-dev \ + libhdf5-dev \ + liblapack-dev \ + libopenmpi-dev \ + openmpi-bin \ + openmpi-common \ + openmpi-doc \ + python3-clang-${LLVM} \ + python3-dev \ + python3-mako \ + python3-matplotlib \ + python3-mpi4py \ + python3-numpy \ + python3-pip \ + python3-scipy \ + python3-sphinx \ + python3-nbsphinx + +ENV PYTHON_VERSION=3.8 \ + CC=clang-${LLVM} CXX=clang++-${LLVM} CXXFLAGS="-stdlib=libc++" +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM} 60 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM} --slave /usr/bin/clang-cpp clang-cpp /usr/bin/clang-cpp-${LLVM} diff --git a/packaging/Dockerfile.ubuntu-gcc b/packaging/Dockerfile.ubuntu-gcc new file mode 100644 index 0000000..2ac2476 --- /dev/null +++ b/packaging/Dockerfile.ubuntu-gcc @@ -0,0 +1,32 @@ +FROM ubuntu:bionic +ARG RELEASE=bionic + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + cmake \ + g++ \ + gfortran \ + git \ + vim \ + lldb-9 \ + hdf5-tools \ + libblas-dev \ + libboost-all-dev \ + libfftw3-dev \ + libgfortran3 \ + libgmp-dev \ + libhdf5-dev \ + liblapack-dev \ + libopenmpi-dev \ + openmpi-bin \ + openmpi-common \ + openmpi-doc \ + python3-dev \ + python3-mako \ + python3-matplotlib \ + python3-mpi4py \ + python3-numpy \ + python3-pip \ + python3-scipy + +ENV PYTHON_VERSION=3.6 \ + CC=gcc CXX=g++ diff --git a/packaging/conda/meta.yaml b/packaging/conda/meta.yaml index 2fd369e..76ef2b8 100644 --- a/packaging/conda/meta.yaml +++ b/packaging/conda/meta.yaml @@ -19,16 +19,12 @@ requirements: - {{ compiler('c') }} - {{ compiler('cxx') }} host: - - triqs {{ '.'.join(version.split('.')[:2]) }} - - boost-cpp - hdf5 - {{ mpi }} - libblas - liblapack - python run: - - {{ pin_compatible("triqs", max_pin="x.x") }} - - boost-cpp - hdf5 - {{ mpi }} - libblas diff --git a/python/app4triqs/CMakeLists.txt b/python/app4triqs/CMakeLists.txt index df7b79c..3049509 100644 --- a/python/app4triqs/CMakeLists.txt +++ b/python/app4triqs/CMakeLists.txt @@ -10,9 +10,9 @@ foreach(file ${python_sources}) endforeach() # Install python files to proper location -set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME}) +set(PYTHON_LIB_DEST ${PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT} FILES_MATCHING PATTERN "*.py" PATTERN "*_desc.py" EXCLUDE) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${PYTHON_LIB_DEST_ROOT} FILES_MATCHING PATTERN "*.py" PATTERN "*_desc.py" EXCLUDE) # Build and install any python modules foreach(gen ${wrap_generators}) @@ -20,6 +20,6 @@ foreach(gen ${wrap_generators}) get_filename_component(module_name ${gen} NAME_WE) get_filename_component(module_dir ${gen} DIRECTORY) add_cpp2py_module(NAME ${module_name} DIRECTORY ${module_dir}) - target_link_libraries(${module_name} ${PROJECT_NAME}_c triqs_py) + target_link_libraries(${module_name} ${PROJECT_NAME}_c) install(TARGETS ${module_name} DESTINATION ${PYTHON_LIB_DEST}/${module_dir}) endforeach() diff --git a/python/app4triqs/app4triqs_module_desc.py b/python/app4triqs/app4triqs_module_desc.py index eff521b..92b3335 100644 --- a/python/app4triqs/app4triqs_module_desc.py +++ b/python/app4triqs/app4triqs_module_desc.py @@ -1,5 +1,5 @@ # Generated automatically using the command : -# c++2py ../../c++/app4triqs/app4triqs.hpp -p --members_read_only -N app4triqs -a app4triqs -m app4triqs_module -o app4triqs_module --moduledoc="The app4triqs python module" -C pytriqs --cxxflags="-std=c++17" --target_file_only +# c++2py ../../c++/app4triqs/app4triqs.hpp -p --members_read_only -N app4triqs -a app4triqs -m app4triqs_module -o app4triqs_module --moduledoc="The app4triqs python module" --cxxflags="-std=c++17" --target_file_only from cpp2py.wrap_generator import * # The module diff --git a/python/app4triqs/version.py.in b/python/app4triqs/version.py.in index 2d63daf..475c61e 100644 --- a/python/app4triqs/version.py.in +++ b/python/app4triqs/version.py.in @@ -22,11 +22,10 @@ ################################################################################ version = "@PROJECT_VERSION@" -triqs_hash = "@TRIQS_GIT_HASH@" @PROJECT_NAME@_hash = "@PROJECT_GIT_HASH@" def show_version(): print("\nYou are using @PROJECT_NAME@ version %s\n"%version) def show_git_hash(): - print("\nYou are using @PROJECT_NAME@ git hash %s based on triqs git hash %s\n"%("@PROJECT_GIT_HASH@", triqs_hash)) + print("\nYou are using @PROJECT_NAME@ git hash %s\n"%("@PROJECT_GIT_HASH@")) diff --git a/requirements.txt b/requirements.txt index 21ccef9..4c6523a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,4 @@ # Required python packages for this application (these should also be added to Dockerfile for Jenkins) +numpy>=1.8.0 +scipy +mako diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index f6da519..5b3ea2a 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(cmake) -if(NOT CMAKE_INSTALL_PREFIX STREQUAL TRIQS_ROOT AND NOT IS_SUBPROJECT) +if(NOT IS_SUBPROJECT) if(PythonSupport) set(EXPORT_PYTHON_PATH "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CPP2PY_PYTHON_LIB_DEST_ROOT}:$PYTHONPATH") @@ -18,7 +18,7 @@ if(NOT CMAKE_INSTALL_PREFIX STREQUAL TRIQS_ROOT AND NOT IS_SUBPROJECT) ) message(STATUS "***************************************************************") - message(STATUS "* Custom install Location. Use: ") + message(STATUS "* Use: ") message(STATUS "* ") message(STATUS "* source ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}vars.sh ") message(STATUS "* ") diff --git a/share/app4triqs.modulefile.in b/share/app4triqs.modulefile.in index 2c9befe..6b6289d 100644 --- a/share/app4triqs.modulefile.in +++ b/share/app4triqs.modulefile.in @@ -20,10 +20,6 @@ proc ModulesHelp { } { puts stderr "Git hash: $git_hash" } -# You may need to edit the next line if the triqs module -# is installed under a different name in your setup. -prereq triqs/@TRIQS_VERSION@ - # Only one version of @PROJECT_NAME@ can be loaded at a time conflict $name diff --git a/share/cmake/Modules/Findsanitizer.cmake b/share/cmake/Modules/Findsanitizer.cmake new file mode 100644 index 0000000..2d51adf --- /dev/null +++ b/share/cmake/Modules/Findsanitizer.cmake @@ -0,0 +1,97 @@ +# Copyright Nils Wentzell 2018 +# Distributed under the GNU GENERAL PUBLIC LICENSE Version 3.0. +# See accompanying file LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt +# +# This cmake find module looks for the LLVM Sanitizer Runtime Librariies +# It sets up SANITIZER_RT_PRELOAD and ${COMPONENT}_RT_LIBRARY for each +# requested component. +# +# Use this module by invoking find_package with the form:: +# +# find_package(sanitizer [REQUIRED] [asan] [ubsan]) +# +# Results are reported in:: +# +# SANITIZER_RT_PRELOAD Environment setting to load all Sanitizer Runtime Libraries +# ${COMPONENT}_RT_LIBRARY Individual Sanitizer Runtime Library + +if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-resource-dir + OUTPUT_VARIABLE clang_resource_dir OUTPUT_STRIP_TRAILING_WHITESPACE) + set(prefix clang_rt.) + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(search_path ${clang_resource_dir}/lib/darwin) + set(suffix _osx_dynamic) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(search_path ${clang_resource_dir}/lib/linux) + set(suffix -${CMAKE_SYSTEM_PROCESSOR}) + else() + message(FATAL_ERROR "Unknown platform") + endif() +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name + OUTPUT_VARIABLE libgcc_file OUTPUT_STRIP_TRAILING_WHITESPACE) + get_filename_component(search_path ${libgcc_file} DIRECTORY) +else() + message(FATAL_ERROR "Sanitizer is not available for your compiler") +endif() + +set(required_vars "") +foreach(component ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}) + string(TOUPPER ${component} COMPONENT) + if((${component} STREQUAL "ubsan") AND (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") AND ASAN_RT_LIBRARY) + set(component ubsan_minimal) + endif() + + find_library(${COMPONENT}_RT_LIBRARY + NAMES ${prefix}${component}${suffix} ${prefix}${component}_standalone${suffix} + PATHS ${search_path} ${search_path}/../../../) + mark_as_advanced(${COMPONENT}_RT_LIBRARY) + + # Imported target + add_library(lib${component}_rt SHARED IMPORTED) + set_property(TARGET lib${component}_rt PROPERTY IMPORTED_LOCATION ${${COMPONENT}_RT_LIBRARY}) + + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${component}) + list(APPEND required_vars ${COMPONENT}_RT_LIBRARY) + endif() + if(DEFINED sanitizer_rt_libraries) + string(APPEND sanitizer_rt_libraries :${${COMPONENT}_RT_LIBRARY}) + else() + set(sanitizer_rt_libraries ${${COMPONENT}_RT_LIBRARY}) + endif() +endforeach() + +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(preload_var DYLD_INSERT_LIBRARIES) +else() + set(preload_var LD_PRELOAD) +endif() + +set(SANITIZER_RT_PRELOAD ${preload_var}=${sanitizer_rt_libraries} CACHE INTERNAL "Runtime shared libraries needed to load the sanitizer") +mark_as_advanced(SANITIZER_RT_PRELOAD) + +# ----- Create Interface Targets ----- +if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_asan) + add_library(asan INTERFACE) + target_compile_options(asan INTERFACE -fsanitize=address -fno-omit-frame-pointer -ggdb3) + target_link_libraries(asan INTERFACE "-fsanitize=address -fno-omit-frame-pointer$<$: -fuse-ld=gold>") + if(NOT DEFINED ENV{ASAN_OPTIONS}) + message(WARNING "ASAN_OPTIONS is not set. Consider setting ASAN_OPTIONS=symbolize=1:detect_leaks=0 when running tests") + endif() +endif() +if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_ubsan) + add_library(ubsan INTERFACE) + target_compile_options(ubsan INTERFACE -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-omit-frame-pointer -ggdb3) + target_link_libraries(ubsan INTERFACE "-fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-omit-frame-pointer$<$: -fuse-ld=gold>") + if(NOT DEFINED ENV{UBSAN_OPTIONS}) + message(WARNING "UBSAN_OPTIONS is not set. Consider setting UBSAN_OPTIONS=symbolize=1:print_stacktrace=1:halt_on_error=1 when running tests") + endif() +endif() +# ------------------------------------ + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args("sanitizer" + REQUIRED_VARS SANITIZER_RT_PRELOAD ${required_vars} + FAIL_MESSAGE "Sanitizer Runtime Libraries not found! Consider installing for additional checks!" +) diff --git a/test/Dockerfile.msan b/test/Dockerfile.msan new file mode 100644 index 0000000..10754dc --- /dev/null +++ b/test/Dockerfile.msan @@ -0,0 +1,68 @@ +FROM ubuntu:disco +ENV LLVM_MAJOR_VERSION=9 +ENV APPNAME=myapp + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + clang-${LLVM_MAJOR_VERSION} \ + cmake \ + g++ \ + gfortran \ + git \ + libblas-dev \ + libboost-all-dev \ + libclang-${LLVM_MAJOR_VERSION}-dev \ + libfftw3-dev \ + libgfortran3 \ + libgmp-dev \ + zlib1g-dev \ + intel-mkl \ + python-clang-${LLVM_MAJOR_VERSION} \ + python-dev \ + python-h5py \ + python-mako \ + python-matplotlib \ + python-numpy \ + python-scipy \ + python-sphinx \ + python-nbsphinx \ + python-pip + +ENV CC=clang-${LLVM_MAJOR_VERSION} CXX=clang++-${LLVM_MAJOR_VERSION} LLVM_VERSION=${LLVM_MAJOR_VERSION}.0.0 + +ADD http://releases.llvm.org/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz /tmp/ +ADD http://releases.llvm.org/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz /tmp/ +RUN mkdir /tmp/build && cd /tmp/build && \ + tar -C /tmp -xf /tmp/libcxx-${LLVM_VERSION}.src.tar.xz && \ + tar -C /tmp -xf /tmp/libcxxabi-${LLVM_VERSION}.src.tar.xz && \ + cmake /tmp/libcxxabi-${LLVM_VERSION}.src -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-${LLVM_MAJOR_VERSION} -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-${LLVM_MAJOR_VERSION} -DLIBCXXABI_LIBCXX_PATH=/tmp/libcxx-${LLVM_VERSION}.src -DLLVM_USE_SANITIZER=Memory && make -j2 && make install && \ + rm -rf * && \ + cmake /tmp/libcxx-${LLVM_VERSION}.src -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-${LLVM_MAJOR_VERSION} -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-${LLVM_MAJOR_VERSION} -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS=/tmp/libcxxabi-${LLVM_VERSION}.src/include -DLLVM_USE_SANITIZER=Memory && make -j2 install && \ + rm -rf /tmp/libcxx* /tmp/build +ENV CXXFLAGS="-stdlib=libc++ -fsanitize=memory" CFLAGS="-fsanitize=memory" LD_LIBRARY_PATH=/usr/lib/llvm-${LLVM_MAJOR_VERSION}/lib LDFLAGS="-fsanitize=memory" + +RUN update-alternatives --set liblapack.so-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libmkl_rt.so && \ + update-alternatives --set libblas.so-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libmkl_rt.so + +ADD https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/CMake-hdf5-1.10.5.tar.gz /tmp/ +RUN mkdir /tmp/build && cd /tmp/build && \ + tar -C /tmp -xf /tmp/CMake-hdf5-1.10.5.tar.gz && \ + cmake /tmp/CMake-hdf5-1.10.5/hdf5-1.10.5 -DCMAKE_INSTALL_PREFIX=/usr && make -j2 && make install && \ + rm -rf * && \ + rm -rf /tmp/CMake-hdf5-1.10.5* /tmp/build + +RUN useradd -m build + +ENV SRC=/src \ + BUILD=/home/build \ + INSTALL=/usr/local \ + PYTHONPATH=/usr/local/lib/python2.7/site-packages:${PYTHONPATH} \ + CMAKE_PREFIX_PATH=/usr/lib/cmake/${APPNAME}:${CMAKE_PREFIX_PATH} + +COPY . ${SRC}/${APPNAME} +WORKDIR ${BUILD}/${APPNAME} +RUN chown -R build ${SRC}/${APPNAME} . +USER build +RUN cmake $SRC/nda -DCMAKE_INSTALL_PREFIX=$INSTALL -DMSAN=ON -DPYTHON_EXECUTABLE=$(which python) +RUN make VERBOSE=1 -j8 +ENV MSAN_SYMBOLIZER_PATH=/usr/lib/llvm-${LLVM_MAJOR_VERSION}/bin/llvm-symbolizer CTEST_OUTPUT_ON_FAILURE=1 +RUN make test || true diff --git a/test/c++/basic.cpp b/test/c++/basic.cpp index aecf689..4629cd1 100644 --- a/test/c++/basic.cpp +++ b/test/c++/basic.cpp @@ -1,4 +1,4 @@ -#include +#include #include using namespace app4triqs; diff --git a/test/python/Basic.py b/test/python/Basic.py index 9ff46e2..d5e20c2 100644 --- a/test/python/Basic.py +++ b/test/python/Basic.py @@ -3,8 +3,8 @@ import unittest from app4triqs import Toto, chain -from triqs.archive import * -from triqs.utility import mpi + +from h5.archive import HDFArchive class test_toto(unittest.TestCase): @@ -16,26 +16,14 @@ def test_add(self): c=a+b self.assertEqual(c, b) - def test_h5(self): - + a=Toto(0) with HDFArchive("f.h5",'w') as A: A["a"] = a with HDFArchive("f.h5",'r') as A: a_read = A["a"] self.assertEqual(a, a_read) - - - def test_mpi(self): - - a=Toto(0) - - if mpi.is_master_node(): - a=Toto(1) - mpi.bcast(a) - - self.assertEqual(a, Toto(1)) class test_chain(unittest.TestCase): diff --git a/test/python/CMakeLists.txt b/test/python/CMakeLists.txt index aa9d877..7b849ba 100644 --- a/test/python/CMakeLists.txt +++ b/test/python/CMakeLists.txt @@ -10,6 +10,6 @@ set(all_tests Basic) foreach(test ${all_tests}) get_filename_component(test_name ${test} NAME_WE) get_filename_component(test_dir ${test} DIRECTORY) - add_test(NAME Py_${test_name} COMMAND ${TRIQS_PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) - set_property(TEST Py_${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD}) + add_test(NAME Py_${test_name} COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) + set_property(TEST Py_${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/python:${h5_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD}) endforeach() From 0456dfaaf393681925e3fee2bf6d090ef5f9770f Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Thu, 5 Sep 2019 16:53:34 -0400 Subject: [PATCH 32/32] Create a C++-only version of the app4triqs skeleton --- CMakeLists.txt | 8 --- README.md | 7 +-- c++/app4triqs/app4triqs.cpp | 2 +- deps/CMakeLists.txt | 2 +- doc/CMakeLists.txt | 6 -- doc/documentation.rst | 11 ---- python/app4triqs/CMakeLists.txt | 25 -------- python/app4triqs/__init__.py | 30 --------- python/app4triqs/app4triqs_module_desc.py | 76 ----------------------- python/app4triqs/version.py.in | 31 --------- share/CMakeLists.txt | 5 -- share/app4triqs.modulefile.in | 1 - share/app4triqsvars.sh.in | 1 - share/cmake/app4triqs-config.cmake.in | 3 - test/CMakeLists.txt | 4 -- test/python/Basic.py | 38 ------------ test/python/CMakeLists.txt | 15 ----- 17 files changed, 4 insertions(+), 261 deletions(-) delete mode 100644 python/app4triqs/CMakeLists.txt delete mode 100644 python/app4triqs/__init__.py delete mode 100644 python/app4triqs/app4triqs_module_desc.py delete mode 100644 python/app4triqs/version.py.in delete mode 100644 test/python/Basic.py delete mode 100644 test/python/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 89820f7..920baed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,9 +62,6 @@ if(NOT IS_SUBPROJECT) message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------") endif() -# Python Support -option(PythonSupport "Build with Python support" ON) - # Documentation option(Build_Documentation "Build documentation" OFF) @@ -130,11 +127,6 @@ if(Build_Tests) add_subdirectory(test) endif() -# Python -if(PythonSupport) - add_subdirectory(python/${PROJECT_NAME}) -endif() - # Docs if(Build_Documentation) add_subdirectory(doc) diff --git a/README.md b/README.md index 67c9f48..71c7ca8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ To adapt this skeleton for a new TRIQS application, the following steps are nece * Run the following commands in order after replacing **appname** accordingly ```bash -git clone https://github.com/triqs/app4triqs --branch unstable appname +git clone https://github.com/triqs/app4triqs --branch cpp_only appname cd appname ./share/squash_history.sh ./share/replace_and_rename.py appname @@ -36,7 +36,7 @@ You can merge future changes to the app4triqs skeleton into your project with th ```bash git remote update -git merge app4triqs_remote/unstable -m "Merge latest app4triqs skeleton changes" +git merge app4triqs_remote/cpp_only -m "Merge latest app4triqs skeleton changes" ``` If you should encounter any conflicts resolve them and `git commit`. @@ -56,9 +56,6 @@ according to your needs (replace app4triqs in the following by the name of your * Adjust or remove the `README.md` and `doc/ChangeLog.md` file * In the `c++/app4triqs` subdirectory adjust the example files `app4triqs.hpp` and `app4triqs.cpp` or add your own source files. * In the `test/c++` subdirectory adjust the example test `basic.cpp` or add your own tests. -* In the `python/app4triqs` subdirectory add your Python source files. - Be sure to remove the `app4triqs_module_desc.py` file unless you want to generate a Python module from your C++ source code. -* In the `test/python` subdirectory adjust the example test `Basic.py` or add your own tests. * Adjust any documentation examples given as `*.rst` files in the doc directory. * Adjust the sphinx configuration in `doc/conf.py.in` as necessary. * The build and install process is identical to the one outline [here](https://triqs.github.io/app4triqs/unstable/install.html). diff --git a/c++/app4triqs/app4triqs.cpp b/c++/app4triqs/app4triqs.cpp index 5d65b97..a16840c 100644 --- a/c++/app4triqs/app4triqs.cpp +++ b/c++/app4triqs/app4triqs.cpp @@ -19,7 +19,7 @@ namespace app4triqs { void h5_write(h5::group grp, std::string subgroup_name, toto const &m) { grp = subgroup_name.empty() ? grp : grp.create_group(subgroup_name); h5_write(grp, "i", m.i); - h5_write_attribute(grp, "TRIQS_HDF5_data_scheme", toto::hdf5_format()); + h5_write_attribute(grp, "Format", toto::hdf5_format()); } void h5_read(h5::group grp, std::string subgroup_name, toto &m) { diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index be17223..a66b105 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -48,7 +48,7 @@ else() endif() # -- Cpp2Py -- -if(PythonSupport OR Build_Documentation) +if(Build_Documentation) external_dependency(Cpp2Py GIT_REPO https://github.com/TRIQS/cpp2py VERSION 2.0 diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2ca1bd4..166df09 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -60,12 +60,6 @@ add_custom_command( option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF) if(NOT Sphinx_Only) - # Autodoc usage requires the python modules to be built first - get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST) - if(CPP2PY_MODULES_LIST) - add_dependencies(${PROJECT_NAME}_docs_sphinx ${CPP2PY_MODULES_LIST}) - endif() - # Generation of C++ Api and Example Outputs add_dependencies(${PROJECT_NAME}_docs_sphinx ${PROJECT_NAME}_docs_cpp2rst ${PROJECT_NAME}_docs_example_output) endif() diff --git a/doc/documentation.rst b/doc/documentation.rst index e4408d1..71bdc00 100644 --- a/doc/documentation.rst +++ b/doc/documentation.rst @@ -28,14 +28,3 @@ C++ reference manual :maxdepth: 5 cpp2rst_generated/contents - -Python reference manual ------------------------ - -.. automodule:: app4triqs - :members: - -.. autoclass:: app4triqs.app4triqs_module.Toto - :members: - -.. autofunction:: app4triqs.app4triqs_module.chain diff --git a/python/app4triqs/CMakeLists.txt b/python/app4triqs/CMakeLists.txt deleted file mode 100644 index 3049509..0000000 --- a/python/app4triqs/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Configure the version -configure_file(version.py.in version.py) - -# All Python files. Copy them in the build dir to have a complete package for the tests. -file(GLOB_RECURSE python_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py) -file(GLOB_RECURSE wrap_generators RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_desc.py) -list(REMOVE_ITEM python_sources "${wrap_generators}") -foreach(file ${python_sources}) - configure_file(${file} ${file} COPYONLY) -endforeach() - -# Install python files to proper location -set(PYTHON_LIB_DEST ${PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME}) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${PYTHON_LIB_DEST_ROOT} FILES_MATCHING PATTERN "*.py" PATTERN "*_desc.py" EXCLUDE) - -# Build and install any python modules -foreach(gen ${wrap_generators}) - string(REPLACE "_desc.py" "" gen ${gen}) - get_filename_component(module_name ${gen} NAME_WE) - get_filename_component(module_dir ${gen} DIRECTORY) - add_cpp2py_module(NAME ${module_name} DIRECTORY ${module_dir}) - target_link_libraries(${module_name} ${PROJECT_NAME}_c) - install(TARGETS ${module_name} DESTINATION ${PYTHON_LIB_DEST}/${module_dir}) -endforeach() diff --git a/python/app4triqs/__init__.py b/python/app4triqs/__init__.py deleted file mode 100644 index 1d6bdf5..0000000 --- a/python/app4triqs/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -################################################################################ -# -# TRIQS: a Toolbox for Research in Interacting Quantum Systems -# -# Copyright (C) 2016-2018, N. Wentzell -# Copyright (C) 2018-2019, The Simons Foundation -# author: N. Wentzell -# -# TRIQS is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# TRIQS. If not, see . -# -################################################################################ - -r""" -DOC - -""" -from .app4triqs_module import Toto, chain - -__all__ = ['Toto', 'chain'] diff --git a/python/app4triqs/app4triqs_module_desc.py b/python/app4triqs/app4triqs_module_desc.py deleted file mode 100644 index 92b3335..0000000 --- a/python/app4triqs/app4triqs_module_desc.py +++ /dev/null @@ -1,76 +0,0 @@ -# Generated automatically using the command : -# c++2py ../../c++/app4triqs/app4triqs.hpp -p --members_read_only -N app4triqs -a app4triqs -m app4triqs_module -o app4triqs_module --moduledoc="The app4triqs python module" --cxxflags="-std=c++17" --target_file_only -from cpp2py.wrap_generator import * - -# The module -module = module_(full_name = "app4triqs_module", doc = r"The app4triqs python module", app_name = "app4triqs") - -# Imports - -# Add here all includes -module.add_include("app4triqs/app4triqs.hpp") - -# Add here anything to add in the C++ code at the start, e.g. namespace using -module.add_preamble(""" -#include - -using namespace app4triqs; -""") - - -# The class toto -c = class_( - py_type = "Toto", # name of the python class - c_type = "app4triqs::toto", # name of the C++ class - doc = r"""A very useful and important class""", # doc of the C++ class - hdf5 = True, - arithmetic = ("add_only"), - comparisons = "==", - serializable = "tuple" -) - -c.add_constructor("""()""", doc = r"""""") - -c.add_constructor("""(int i_)""", doc = r"""Construct from integer - -Parameters ----------- -i_ - a scalar :math:`G(\tau)`""") - -c.add_method("""int f (int u)""", - doc = r"""A simple function with :math:`G(\tau)` - -Parameters ----------- -u - Nothing useful""") - -c.add_method("""std::string hdf5_format ()""", - is_static = True, - doc = r"""HDF5""") - -c.add_property(name = "i", - getter = cfunction("int get_i ()"), - doc = r"""Simple accessor""") - -module.add_class(c) - -module.add_function ("int app4triqs::chain (int i, int j)", doc = r"""Chain digits of two integers - -Parameters ----------- -i - The first integer - -j - The second integer - -Returns -------- -out - An integer containing the digits of both i and j""") - - - -module.generate_code() diff --git a/python/app4triqs/version.py.in b/python/app4triqs/version.py.in deleted file mode 100644 index 475c61e..0000000 --- a/python/app4triqs/version.py.in +++ /dev/null @@ -1,31 +0,0 @@ -################################################################################ -# -# TRIQS: a Toolbox for Research in Interacting Quantum Systems -# -# Copyright (C) 2016-2018, N. Wentzell -# Copyright (C) 2018-2019, Simons Foundation -# author: N. Wentzell -# -# TRIQS is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# TRIQS. If not, see . -# -################################################################################ - -version = "@PROJECT_VERSION@" -@PROJECT_NAME@_hash = "@PROJECT_GIT_HASH@" - -def show_version(): - print("\nYou are using @PROJECT_NAME@ version %s\n"%version) - -def show_git_hash(): - print("\nYou are using @PROJECT_NAME@ git hash %s\n"%("@PROJECT_GIT_HASH@")) diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 5b3ea2a..55aca31 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -2,11 +2,6 @@ add_subdirectory(cmake) if(NOT IS_SUBPROJECT) - if(PythonSupport) - set(EXPORT_PYTHON_PATH "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CPP2PY_PYTHON_LIB_DEST_ROOT}:$PYTHONPATH") - set(MODFILE_PYTHON_PATH "prepend-path PYTHONPATH $root/${CPP2PY_PYTHON_LIB_DEST_ROOT}") - endif() - configure_file(${PROJECT_NAME}.modulefile.in ${PROJECT_NAME}.modulefile @ONLY) configure_file(${PROJECT_NAME}vars.sh.in ${PROJECT_NAME}vars.sh @ONLY) diff --git a/share/app4triqs.modulefile.in b/share/app4triqs.modulefile.in index 6b6289d..bde963c 100644 --- a/share/app4triqs.modulefile.in +++ b/share/app4triqs.modulefile.in @@ -32,4 +32,3 @@ prepend-path CPLUS_INCLUDE_PATH $root/include prepend-path LIBRARY_PATH $root/lib prepend-path LD_LIBRARY_PATH $root/lib prepend-path CMAKE_PREFIX_PATH $root -@MODFILE_PYTHON_PATH@ diff --git a/share/app4triqsvars.sh.in b/share/app4triqsvars.sh.in index 492a7a2..e4428fd 100644 --- a/share/app4triqsvars.sh.in +++ b/share/app4triqsvars.sh.in @@ -7,4 +7,3 @@ export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH export LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:$LIBRARY_PATH export LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:$LD_LIBRARY_PATH export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@:$CMAKE_PREFIX_PATH -@EXPORT_PYTHON_PATH@ diff --git a/share/cmake/app4triqs-config.cmake.in b/share/cmake/app4triqs-config.cmake.in index ef926ef..84f1be7 100644 --- a/share/cmake/app4triqs-config.cmake.in +++ b/share/cmake/app4triqs-config.cmake.in @@ -25,7 +25,4 @@ message(STATUS "Found @PROJECT_NAME@-config.cmake with version @PROJECT_VERSION@ # Was the Project built with Documentation? set(@PROJECT_NAME@_WITH_DOCUMENTATION @Build_Documentation@ CACHE BOOL "Was @PROJECT_NAME@ build with documentation?") -# Was the Project built with PythonSupport? -set(@PROJECT_NAME@_WITH_PYTHON_SUPPORT @PythonSupport@ CACHE BOOL "Was @PROJECT_NAME@ build with python support?") - endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e79313f..d93e9ea 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1 @@ add_subdirectory(c++) - -if(PythonSupport) - add_subdirectory(python) -endif() diff --git a/test/python/Basic.py b/test/python/Basic.py deleted file mode 100644 index d5e20c2..0000000 --- a/test/python/Basic.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -import unittest - -from app4triqs import Toto, chain - -from h5.archive import HDFArchive - -class test_toto(unittest.TestCase): - - def test_add(self): - - a=Toto(0) - b=Toto(2) - - c=a+b - self.assertEqual(c, b) - - def test_h5(self): - - a=Toto(0) - with HDFArchive("f.h5",'w') as A: - A["a"] = a - with HDFArchive("f.h5",'r') as A: - a_read = A["a"] - self.assertEqual(a, a_read) - -class test_chain(unittest.TestCase): - - def test_chain(self): - - i = 111 - j = 222 - ij = chain(i,j) - self.assertEqual(ij, 111222) - -if __name__ == '__main__': - unittest.main() diff --git a/test/python/CMakeLists.txt b/test/python/CMakeLists.txt deleted file mode 100644 index 7b849ba..0000000 --- a/test/python/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copy h5 files to binary dir -file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5) -foreach(file ${all_h5_ref_files}) - configure_file(${file} ${file} COPYONLY) -endforeach() - -# List of all tests -set(all_tests Basic) - -foreach(test ${all_tests}) - get_filename_component(test_name ${test} NAME_WE) - get_filename_component(test_dir ${test} DIRECTORY) - add_test(NAME Py_${test_name} COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) - set_property(TEST Py_${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/python:${h5_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD}) -endforeach()