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

Preserving case style in additional_switches #2421

Merged
merged 6 commits into from
Oct 16, 2023
Merged
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ omit = [
show_missing = true

[tool.codespell]
skip = '*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./doc/build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/source/examples/*,*cover,*.dat,*.mac,*.cdb,build,./docker/mapdl/v*,./factory/*,./ansys/mapdl/core/mapdl_functions.py,PKG-INFO,*.mypy_cache/*,./docker/mapdl/*,./_unused/*'
skip = '*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./doc/build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/source/examples/*,*cover,*.dat,*.mac,*.cdb,*.CDB,build,./docker/mapdl/v*,./factory/*,./ansys/mapdl/core/mapdl_functions.py,PKG-INFO,*.mypy_cache/*,./docker/mapdl/*,./_unused/*'
ignore-words = "doc/styles/Vocab/ANSYS/accept.txt"
quiet-level = 3
ignore-regex=".*codespell-ignore$|NORML|POIN"
14 changes: 8 additions & 6 deletions src/ansys/mapdl/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,10 @@ def _validate_MPI(add_sw, exec_path, force_intel=False):

"""
# Converting additional_switches to lower case to avoid mismatches.
add_sw = add_sw.lower()
add_sw_lower_case = add_sw.lower()

# known issues with distributed memory parallel (DMP)
if "smp" not in add_sw: # pragma: no cover
if "smp" not in add_sw_lower_case: # pragma: no cover
# Ubuntu ANSYS fails to launch without I_MPI_SHM_LMT
if _is_ubuntu():
LOG.debug("Ubuntu system detected. Adding 'I_MPI_SHM_LMT' env var.")
Expand All @@ -887,13 +887,13 @@ def _validate_MPI(add_sw, exec_path, force_intel=False):
# change for each client/person using the VPN.
#
# Adding '-mpi msmpi' to the launch parameter fix it.
if "intelmpi" in add_sw:
if "intelmpi" in add_sw_lower_case:
LOG.debug(
"Intel MPI flag detected. Removing it, if you want to enforce it, use ``force_intel`` keyword argument."
)
# Remove intel flag.
regex = "(-mpi)( *?)(intelmpi)"
add_sw = re.sub(regex, "", add_sw)
add_sw = re.sub(regex, "", add_sw, flags=re.IGNORECASE)
warnings.warn(INTEL_MSG)

LOG.debug("Forcing Microsoft MPI (MSMPI) to avoid VPN issues.")
Expand All @@ -919,10 +919,12 @@ def _force_smp_student_version(add_sw, exec_path):

"""
# Converting additional_switches to lower case to avoid mismatches.
add_sw = add_sw.lower()
add_sw_lower_case = add_sw.lower()

if (
"-mpi" not in add_sw and "-dmp" not in add_sw and "-smp" not in add_sw
"-mpi" not in add_sw_lower_case
and "-dmp" not in add_sw_lower_case
and "-smp" not in add_sw_lower_case
): # pragma: no cover
if "student" in exec_path.lower():
add_sw += " -smp"
Expand Down
7 changes: 5 additions & 2 deletions tests/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def test_validate_sw():
add_sw = _validate_MPI("-mpi intelmpi", exec_path)
assert "msmpi" in add_sw and "intelmpi" not in add_sw

add_sw = _validate_MPI("-mpi INTELMPI", exec_path)
assert "msmpi" in add_sw and "INTELMPI" not in add_sw


@skip_if_not_local
@pytest.mark.parametrize("path_data", paths)
Expand Down Expand Up @@ -331,9 +334,9 @@ def test__force_smp_student_version():
exec_path = r"C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ANSYS222.exe"
assert "-smp" not in _force_smp_student_version(add_sw, exec_path)

add_sw = "-smp"
add_sw = "-SMP"
exec_path = r"C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ANSYS222.exe"
assert "-smp" in _force_smp_student_version(add_sw, exec_path)
assert "-SMP" in _force_smp_student_version(add_sw, exec_path)


@pytest.mark.parametrize(
Expand Down