Skip to content

Commit

Permalink
Fix bug: messing with LD_LIBRARY_PATH when in conda environment (#223)
Browse files Browse the repository at this point in the history
* Added is_conda function to fsops and used to
detect conda environment and not muck about with LD_LIBRARY_PATH

* Changed default nodesize and memory to 48 and 192GB respectively
as these are the default values for gadi
  • Loading branch information
aidanheerdegen committed Feb 6, 2020
1 parent 3386a5b commit bf2d8c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 6 additions & 3 deletions payu/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import payu
import payu.envmod as envmod
from payu.fsops import is_conda
from payu.models import index as supported_models
import payu.subcommands
from payu.scheduler.pbs import generate_command
Expand Down Expand Up @@ -83,9 +84,11 @@ def set_env_vars(init_run=None, n_runs=None, lab_path=None, dir_path=None,
"""Construct the environment variables used by payu for resubmissions."""
payu_env_vars = {}

# Setup Python dynamic library link
lib_paths = sysconfig.get_config_vars('LIBDIR')
payu_env_vars['LD_LIBRARY_PATH'] = ':'.join(lib_paths)
if not is_conda():
# Setup Python dynamic library link
lib_paths = sysconfig.get_config_vars('LIBDIR')
payu_env_vars['LD_LIBRARY_PATH'] = ':'.join(lib_paths)

if 'PYTHONPATH' in os.environ:
payu_env_vars['PYTHONPATH'] = os.environ['PYTHONPATH']

Expand Down
7 changes: 7 additions & 0 deletions payu/fsops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Standard library
import errno
import os
import sys

# Extensions
import yaml
Expand Down Expand Up @@ -134,3 +135,9 @@ def check_exe_path(payu_path, pbs_script):
assert os.path.isfile(pbs_script)

return pbs_script


def is_conda():
"""Return True if python interpreter is in a conda environment"""

return os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
4 changes: 2 additions & 2 deletions payu/subcommands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def runcmd(model_type, config_path, init_run, n_runs, lab_path, reproduce):

# TODO: Create drivers for servers
platform = pbs_config.get('platform', {})
max_cpus_per_node = platform.get('nodesize', 16)
max_ram_per_node = platform.get('nodemem', 32)
max_cpus_per_node = platform.get('nodesize', 48)
max_ram_per_node = platform.get('nodemem', 192)

# Adjust the CPUs for any model-specific settings
# TODO: Incorporate this into the Model driver
Expand Down

0 comments on commit bf2d8c5

Please sign in to comment.