diff --git a/pyproject.toml b/pyproject.toml index b7872d057d..900e10a19f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" \ No newline at end of file diff --git a/src/ansys/mapdl/core/launcher.py b/src/ansys/mapdl/core/launcher.py index f29b40e55e..a50a4758d9 100644 --- a/src/ansys/mapdl/core/launcher.py +++ b/src/ansys/mapdl/core/launcher.py @@ -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.") @@ -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.") @@ -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" diff --git a/tests/test_launcher.py b/tests/test_launcher.py index 59d8fd369c..3cfc64763c 100644 --- a/tests/test_launcher.py +++ b/tests/test_launcher.py @@ -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) @@ -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(