Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle repository to 80 columns. #323

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

3 changes: 2 additions & 1 deletion Documentation/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
html_static_path = ['_static']


# Don't sort module contents alphabetically, we want to order them in a helpful way for the user to read.
# Don't sort module contents alphabetically, we want to order them in a
# helpful way for the user to read.
autodoc_member_order = 'bysource'


Expand Down
8 changes: 6 additions & 2 deletions run_configs/gcom/grab_gcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
if __name__ == '__main__':

# note: we can add arguments to grab_config.arg_parser here
# todo: do a real example of this in one of the configs, or at least in the docs.
# todo: do a real example of this in one of the configs, or at least in
# the docs.

with grab_config:
fcm_export(grab_config, src='fcm:gcom.xm_tr/build', revision=revision, dst_label="gcom")
fcm_export(grab_config,
src='fcm:gcom.xm_tr/build',
revision=revision,
dst_label="gcom")
23 changes: 18 additions & 5 deletions run_configs/jules/build_jules.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ def __init__(self):

with BuildConfig(project_label=f'jules {revision} $compiler',
tool_box=tool_box) as state:
# grab the source. todo: use some checkouts instead of exports in these configs.
fcm_export(state, src='fcm:jules.xm_tr/src', revision=revision, dst_label='src')
fcm_export(state, src='fcm:jules.xm_tr/utils', revision=revision, dst_label='utils')
# grab the source. todo: use some checkouts instead of exports in
# these configs.
fcm_export(state,
src='fcm:jules.xm_tr/src',
revision=revision,
dst_label='src')
fcm_export(state,
src='fcm:jules.xm_tr/utils',
revision=revision,
dst_label='utils')

grab_pre_build(state, path='/not/a/real/folder', allow_fail=True),

Expand All @@ -61,9 +68,15 @@ def __init__(self):
# move inc files to the root for easy tool use
root_inc_files(state)

preprocess_fortran(state, common_flags=['-P', '-DMPI_DUMMY', '-DNCDF_DUMMY', '-I$output'])
preprocess_fortran(state,
common_flags=['-P',
'-DMPI_DUMMY',
'-DNCDF_DUMMY',
'-I$output'])

analyse(state, root_symbol='jules', unreferenced_deps=['imogen_update_carb'])
analyse(state,
root_symbol='jules',
unreferenced_deps=['imogen_update_carb'])

compile_fortran(state)

Expand Down
309 changes: 199 additions & 110 deletions run_configs/lfric/atm.py

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions run_configs/lfric/grab_lfric.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,30 @@
# these configs are interrogated by the build scripts
# todo: doesn't need two separate configs, they use the same project workspace
tool_box = ToolBox()
lfric_source_config = BuildConfig(project_label=f'lfric source {LFRIC_REVISION}',
tool_box=tool_box)
gpl_utils_source_config = BuildConfig(project_label=f'lfric source {LFRIC_REVISION}',
tool_box=tool_box)
lfric_source_config = BuildConfig(
project_label=f'lfric source {LFRIC_REVISION}',
tool_box=tool_box
)
gpl_utils_source_config = BuildConfig(
project_label=f'lfric source {LFRIC_REVISION}',
tool_box=tool_box
)


if __name__ == '__main__':

with lfric_source_config:
fcm_export(
lfric_source_config, src='fcm:lfric.xm_tr', revision=LFRIC_REVISION, dst_label='lfric')
lfric_source_config,
src='fcm:lfric.xm_tr',
revision=LFRIC_REVISION,
dst_label='lfric'
)

with gpl_utils_source_config:
fcm_export(
gpl_utils_source_config, src='fcm:lfric_gpl_utils.xm-tr', revision=LFRIC_REVISION, dst_label='gpl_utils')
gpl_utils_source_config,
src='fcm:lfric_gpl_utils.xm-tr',
revision=LFRIC_REVISION,
dst_label='gpl_utils'
)
64 changes: 47 additions & 17 deletions run_configs/lfric/gungho.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def get_transformation_script(fpath, config):
relative_path = fpath.relative_to(base_path)
except ValueError:
pass
local_transformation_script = optimisation_path / (relative_path.with_suffix('.py'))
local_transformation_script = optimisation_path \
/ (relative_path.with_suffix('.py'))
if local_transformation_script.exists():
return local_transformation_script
global_transformation_script = optimisation_path / 'global.py'
Expand All @@ -49,15 +50,28 @@ def get_transformation_script(fpath, config):

with BuildConfig(project_label='gungho $compiler $two_stage',
tool_box=ToolBox()) as state:
grab_folder(state, src=lfric_source / 'infrastructure/source/', dst_label='')
grab_folder(state, src=lfric_source / 'components/driver/source/', dst_label='')
grab_folder(state, src=lfric_source / 'components' / 'inventory' / 'source', dst_label='')
grab_folder(state, src=lfric_source / 'components/science/source/', dst_label='')
grab_folder(state, src=lfric_source / 'components/lfric-xios/source/', dst_label='')
grab_folder(state,
src=lfric_source / 'infrastructure/source/',
dst_label='')
grab_folder(state,
src=lfric_source / 'components/driver/source/',
dst_label='')
grab_folder(state,
src=lfric_source / 'components' / 'inventory' / 'source',
dst_label='')
grab_folder(state,
src=lfric_source / 'components/science/source/',
dst_label='')
grab_folder(state,
src=lfric_source / 'components/lfric-xios/source/',
dst_label='')
grab_folder(state, src=lfric_source / 'gungho/source/', dst_label='')
grab_folder(state, src=lfric_source / 'um_physics/source/', dst_label='')
grab_folder(state, src=lfric_source / 'miniapps' / 'gungho_model' / 'source', dst_label='')
grab_folder(state, src=lfric_source / 'miniapps' / 'gungho_model' / 'optimisation',
grab_folder(state,
src=lfric_source / 'um_physics' / 'source',
dst_label='')
gungho_model_path = lfric_source / 'miniapps' / 'gungho_model'
grab_folder(state, src=gungho_model_path / 'source', dst_label='')
grab_folder(state, src=gungho_model_path / 'optimisation',
dst_label='optimisation')
grab_folder(state, src=lfric_source / 'jules/source/', dst_label='')
grab_folder(state, src=lfric_source / 'socrates/source/', dst_label='')
Expand All @@ -77,10 +91,15 @@ def get_transformation_script(fpath, config):
preprocess_fortran(
state,
common_flags=[
'-DRDEF_PRECISION=64', '-DR_SOLVER_PRECISION=64', '-DR_TRAN_PRECISION=64', '-DUSE_XIOS',
'-DRDEF_PRECISION=64',
'-DR_SOLVER_PRECISION=64',
'-DR_TRAN_PRECISION=64',
'-DUSE_XIOS',
])

preprocess_x90(state, common_flags=['-DRDEF_PRECISION=64', '-DUSE_XIOS', '-DCOUPLED'])
preprocess_x90(state, common_flags=['-DRDEF_PRECISION=64',
'-DUSE_XIOS',
'-DCOUPLED'])

psyclone(
state,
Expand All @@ -94,7 +113,12 @@ def get_transformation_script(fpath, config):
analyse(
state,
root_symbol='gungho_model',
ignore_mod_deps=['netcdf', 'MPI', 'yaxt', 'pfunit_mod', 'xios', 'mod_wait'],
ignore_mod_deps=['netcdf',
'MPI',
'yaxt',
'pfunit_mod',
'xios',
'mod_wait'],
)

compile_fortran(
Expand All @@ -105,10 +129,15 @@ def get_transformation_script(fpath, config):
'-g',
'-std=f2008',

'-Wall', '-Werror=conversion', '-Werror=unused-variable', '-Werror=character-truncation',
'-Wall',
'-Werror=conversion',
'-Werror=unused-variable',
'-Werror=character-truncation',
'-Werror=unused-value', '-Werror=tabs',

'-DRDEF_PRECISION=64', '-DR_SOLVER_PRECISION=64', '-DR_TRAN_PRECISION=64',
'-DRDEF_PRECISION=64',
'-DR_SOLVER_PRECISION=64',
'-DR_TRAN_PRECISION=64',
'-DUSE_XIOS', '-DUSE_MPI=YES',
],
)
Expand All @@ -119,9 +148,10 @@ def get_transformation_script(fpath, config):
state,
flags=[
'-fopenmp',

'-lyaxt', '-lyaxt_c', '-lnetcdff', '-lnetcdf', '-lhdf5', # EXTERNAL_DYNAMIC_LIBRARIES
'-lxios', # EXTERNAL_STATIC_LIBRARIES
# EXTERNAL_DYNAMIC_LIBRARIES
'-lyaxt', '-lyaxt_c', '-lnetcdff', '-lnetcdf', '-lhdf5',
# EXTERNAL_STATIC_LIBRARIES
'-lxios',
'-lstdc++',
],
)
27 changes: 18 additions & 9 deletions run_configs/lfric/lfric_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ def check_available(self):

# todo: is this part of psyclone? if so, put it in the psyclone step module?
@step
def configurator(config, lfric_source: Path, gpl_utils_source: Path, rose_meta_conf: Path, config_dir=None):

def configurator(config,
lfric_source: Path,
gpl_utils_source: Path,
rose_meta_conf: Path,
config_dir=None):
rose_picker_tool = gpl_utils_source / 'rose_picker/rose_picker'
gen_namelist_tool = lfric_source / 'infrastructure/build/tools/GenerateNamelist'
gen_loader_tool = lfric_source / 'infrastructure/build/tools/GenerateLoader'
gen_feigns_tool = lfric_source / 'infrastructure/build/tools/GenerateFeigns'

tools_path = lfric_source / 'infrastructure' / 'build' / 'tools'
gen_namelist_tool = tools_path / 'GenerateNamelist'
gen_loader_tool = tools_path / 'GenerateLoader'
gen_feigns_tool = tools_path / 'GenerateFeigns'

config_dir = config_dir or config.source_root / 'configuration'

Expand All @@ -37,7 +42,8 @@ def configurator(config, lfric_source: Path, gpl_utils_source: Path, rose_meta_c
env['PYTHONPATH'] += f':{rose_lfric_path}'

# "rose picker"
# creates rose-meta.json and config_namelists.txt in gungho/source/configuration
# creates rose-meta.json and config_namelists.txt in
# gungho/source/configuration
logger.info('rose_picker')
rose_picker = Script(rose_picker_tool)
rose_picker.run(additional_parameters=[str(rose_meta_conf),
Expand All @@ -56,7 +62,8 @@ def configurator(config, lfric_source: Path, gpl_utils_source: Path, rose_meta_c
# create configuration_mod.f90 in source root
logger.info('GenerateLoader')
gen_loader = Script(gen_loader_tool)
names = [name.strip() for name in open(config_dir / 'config_namelists.txt').readlines()]
names = [name.strip()
for name in open(config_dir / 'config_namelists.txt').readlines()]
configuration_mod_fpath = config.source_root / 'configuration_mod.f90'
gen_loader.run(additional_parameters=[configuration_mod_fpath,
*names])
Expand All @@ -70,7 +77,8 @@ def configurator(config, lfric_source: Path, gpl_utils_source: Path, rose_meta_c

# put the generated source into an artefact
# todo: we shouldn't need to do this, should we?
# it's just going to be found in the source folder with everything else.
# it's just going to be found in the source folder with everything
# else.
config._artefact_store['configurator_output'] = [
configuration_mod_fpath,
feign_config_mod_fpath
Expand All @@ -80,7 +88,8 @@ def configurator(config, lfric_source: Path, gpl_utils_source: Path, rose_meta_c
@step
def fparser_workaround_stop_concatenation(config):
"""
fparser can't handle string concat in a stop statement. This step is a workaround.
fparser can't handle string concat in a stop statement. This step is a
workaround.

https://github.com/stfc/fparser/issues/330

Expand Down
42 changes: 31 additions & 11 deletions run_configs/lfric/mesh_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,35 @@
lfric_source = lfric_source_config.source_root / 'lfric'
gpl_utils_source = gpl_utils_source_config.source_root / 'gpl_utils'

# this folder just contains previous output, for testing the overrides mechanism.
# this folder just contains previous output, for testing the overrides
# mechanism.
psyclone_overrides = Path(__file__).parent / 'mesh_tools_overrides'

with BuildConfig(project_label='mesh tools $compiler $two_stage',
tool_box=ToolBox()) as state:
grab_folder(state, src=lfric_source / 'infrastructure/source/', dst_label='')
grab_folder(state, src=lfric_source / 'mesh_tools/source/', dst_label='')
grab_folder(state, src=lfric_source / 'components/science/source/', dst_label='')
grab_folder(state,
src=lfric_source / 'infrastructure/source/',
dst_label='')
grab_folder(state,
src=lfric_source / 'mesh_tools/source/',
dst_label='')
grab_folder(state,
src=lfric_source / 'components/science/source/',
dst_label='')

# grab the psyclone overrides folder into the source folder
grab_folder(state, src=psyclone_overrides, dst_label='mesh_tools_overrides')
grab_folder(state,
src=psyclone_overrides,
dst_label='mesh_tools_overrides')

# generate more source files in source and source/configuration
rose_meta_path = lfric_source / 'mesh_tools' / 'rose-meta' \
/ 'lfric-mesh_tools' / 'HEAD' / 'rose-meta.conf'
configurator(
state,
lfric_source=lfric_source,
gpl_utils_source=gpl_utils_source,
rose_meta_conf=lfric_source / 'mesh_tools/rose-meta/lfric-mesh_tools/HEAD/rose-meta.conf',
rose_meta_conf=rose_meta_path,
)

find_source_files(
Expand All @@ -50,7 +61,9 @@

preprocess_fortran(state)

preprocess_x90(state, common_flags=['-DRDEF_PRECISION=64', '-DUSE_XIOS', '-DCOUPLED'])
preprocess_x90(state, common_flags=['-DRDEF_PRECISION=64',
'-DUSE_XIOS',
'-DCOUPLED'])

psyclone(
state,
Expand All @@ -63,8 +76,11 @@

analyse(
state,
root_symbol=['cubedsphere_mesh_generator', 'planar_mesh_generator', 'summarise_ugrid'],
# ignore_mod_deps=['netcdf', 'MPI', 'yaxt', 'pfunit_mod', 'xios', 'mod_wait'],
root_symbol=['cubedsphere_mesh_generator',
'planar_mesh_generator',
'summarise_ugrid'],
# ignore_mod_deps=['netcdf', 'MPI', 'yaxt', 'pfunit_mod', 'xios',
# 'mod_wait'],
)

compile_fortran(state, common_flags=['-c'])
Expand All @@ -75,8 +91,12 @@
link_exe(
state,
flags=[
'-lyaxt', '-lyaxt_c', '-lnetcdff', '-lnetcdf', '-lhdf5', # EXTERNAL_DYNAMIC_LIBRARIES
'-lxios', # EXTERNAL_STATIC_LIBRARIES
# EXTERNAL_DYNAMIC_LIBRARIES
'-lyaxt', '-lyaxt_c',
'-lnetcdff', '-lnetcdf',
'-lhdf5',
# EXTERNAL_STATIC_LIBRARIES
'-lxios',
'-lstdc++',
],
)
Loading