Skip to content

Commit

Permalink
Update configuration so that changing a build tool causes build tool …
Browse files Browse the repository at this point in the history
…associated libraries to removed from the cache and located again using the new tool-based paths

Revert to using m2w64 fortran since fortran-compiler version not compatible with current msmpi
Change directory where service manager is started to prevent picking up the local yggdrasil source code
  • Loading branch information
langmm committed Jun 20, 2024
1 parent e94ad61 commit f2d352e
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 35 deletions.
4 changes: 3 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ outputs:
- python
run:
- {{ pin_subpackage('yggdrasil.c', exact=True) }}
- {{ compiler('fortran') }}
- m2w64-gcc-fortran # [win]
- m2w64-toolchain_win-64 # [win]
- {{ compiler('fortran') }} # [not win]
- name: yggdrasil.r
build:
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
Expand Down
11 changes: 9 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,12 @@ def project_dir():
return os.path.abspath(os.path.dirname(yggdrasil.__file__))


@pytest.fixture(scope="session")
def external_dir():
r"""Directory outside of the local yggdrasil installation."""
return os.path.dirname(os.getcwd())


@pytest.fixture(scope="session")
def logger():
r"""Package logger."""
Expand Down Expand Up @@ -1064,7 +1070,7 @@ def check_service_manager_settings_w(service_type, partial_commtype=None):

@pytest.fixture(scope="session")
def running_service(pytestconfig, check_service_manager_settings,
project_dir):
project_dir, external_dir, logger):
r"""Context manager to run and clean-up an integration service."""
manager = pytestconfig.pluginmanager
plugin_class = manager.get_plugin('pytest_cov').CovPlugin
Expand Down Expand Up @@ -1095,7 +1101,7 @@ def running_service_w(service_type, partial_commtype=None,
args.append("--track-memory")
if debug:
args.append("--debug")
process_kws = {}
process_kws = {'cwd': external_dir}
if with_coverage:
script_path = os.path.expanduser(os.path.join('~', 'run_server.py'))
process_kws['cwd'] = project_dir
Expand Down Expand Up @@ -1131,6 +1137,7 @@ def running_service_w(service_type, partial_commtype=None,
assert cli.service_type == 'flask'
assert not cli.is_running
p = subprocess.Popen(args, **process_kws)
logger.info(f"Started service manager via {args} ({process_kws})")
try:
cli.wait_for_server()
yield cli
Expand Down
12 changes: 11 additions & 1 deletion utils/requirements/requirements.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,22 @@
"gfortran": [
{
"name": "{{ compiler('fortran') }}",
"method": "conda_recipe"
"method": "conda_recipe",
"os": "unix"
},
{
"name": "fortran-compiler",
"os": "unix",
"method": "conda"
},
{
"name": "m2w64-gcc-fortran",
"os": "win",
"method": "conda",
"add": [
"m2w64-toolchain_win-64"
]
},
{
"name": "gfortran",
"method": "apt"
Expand Down
12 changes: 6 additions & 6 deletions utils/requirements/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ extras:
- gfortran:
- name: "{{ compiler('fortran') }}"
method: conda_recipe
# os: unix
os: unix
- name: fortran-compiler
# os: unix
os: unix
method: conda
# - name: m2w64-gcc-fortran
# os: win
# method: conda
# add: [m2w64-toolchain_win-64]
- name: m2w64-gcc-fortran
os: win
method: conda
add: [m2w64-toolchain_win-64]
- name: gfortran
method: apt
- name: gfortran
Expand Down
4 changes: 3 additions & 1 deletion utils/requirements/requirements_condaonly.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
cmake; platform_system != 'Windows' # [conda,c]
compiler-rt; platform_system == 'Darwin' # [conda,c]
czmq # [conda,zmq]
fortran-compiler # [conda,fortran]
fortran-compiler; platform_system != 'Windows' # [conda,fortran]
ghostscript # [conda,images]
git # [conda]
juliaup # [conda,julia]
lz4 # [conda,zmq]
m2w64-gcc-fortran; platform_system == 'Windows' # [conda,fortran]
m2w64-toolchain_win-64; platform_system == 'Windows' # [conda,fortran]
make; platform_system != 'Windows' # [conda,c]
matplotlib-base # [conda]
mpich; platform_system == 'Linux' # [conda,mpi]
Expand Down
8 changes: 4 additions & 4 deletions yggdrasil/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,10 @@ def update_language_config(languages=None, skip_warnings=False,
ygg_cfg.reload()
if not skip_warnings:
for sect, opt, desc in miss: # pragma: windows
warnings.warn(("Could not set option %s in section %s. "
+ "Please set this in %s to: %s")
% (opt, sect, ygg_cfg_usr.file_to_update, desc),
RuntimeWarning)
warnings.warn(
f"Could not set option {opt} in section {sect}. Please "
f"set this in {ygg_cfg_usr.file_to_update} to: {desc}",
RuntimeWarning)
if verbose:
with open(usr_config_file, 'r') as fd:
print(fd.read())
Expand Down
13 changes: 13 additions & 0 deletions yggdrasil/drivers/CModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ class GCCCompiler(CCompilerBase):
'specialization': 'with_asan'},
}

@classmethod
def is_alias(cls):
r"""Determine if the tool is actually an alias for another tool.
Returns:
bool, str: False if this tool is not an alias, otherwise
return the name of the aliased tool.
"""
if cls.is_clang():
return 'clang'
return super(GCCCompiler, cls).is_alias()

@classmethod
def is_clang(cls):
r"""Determine if this tool is actually an alias for clang.
Expand Down
13 changes: 13 additions & 0 deletions yggdrasil/drivers/CPPModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ class GPPCompiler(CPPCompilerBase, GCCCompiler):
standard_library = 'stdc++'
libraries = {}

@classmethod
def is_alias(cls):
r"""Determine if the tool is actually an alias for another tool.
Returns:
bool, str: False if this tool is not an alias, otherwise
return the name of the aliased tool.
"""
if cls.is_clang():
return 'clang++'
return super(GPPCompiler, cls).is_alias()

@classmethod
def get_flags(cls, skip_standard_flag=False, **kwargs):
r"""Get a list of compiler flags.
Expand Down
Loading

0 comments on commit f2d352e

Please sign in to comment.