|
20 | 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
21 | 21 | # SOFTWARE. |
22 | 22 |
|
23 | | -"""Module that defines some classes for settings.""" |
| 23 | +"""Module that defines classes that hold settings relevant for PyAnsys-Heart.""" |
24 | 24 |
|
25 | 25 | import copy |
26 | 26 | from dataclasses import asdict, dataclass, field |
@@ -1071,112 +1071,6 @@ def _modify_from_global_settings(self): |
1071 | 1071 | self.num_cpus = int(os.getenv("PYANSYS_HEART_NUM_CPU", self.num_cpus)) |
1072 | 1072 | return |
1073 | 1073 |
|
1074 | | - # TODO: @mhoeijm update to ensure compatibility with new LS-DYNA/Ansys versions |
1075 | | - def _set_env_variables(self): |
1076 | | - r"""Try to set environment variables for MPI run using Ansys installation root directories. |
1077 | | -
|
1078 | | - Notes |
1079 | | - ----- |
1080 | | - This is based on lsdynaintelvar.bat and lsdynamsvar.bat in |
1081 | | - ANSYS Inc\v231\ansys\bin\winx64\lsprepost48\LS-Run 1.0 |
1082 | | - and requires you to install the MPI libraries with the Ansys installer. |
1083 | | - """ |
1084 | | - # get latest installed Ansys version |
1085 | | - env_variables = list(os.environ.keys()) |
1086 | | - ansys_env_roots = sorted([k for k in env_variables if "AWP_ROOT" in k]) |
1087 | | - ansys_env_roots.reverse() |
1088 | | - |
1089 | | - if self.platform == "windows": |
1090 | | - platform = "winx64" |
1091 | | - elif self.platform == "linux": |
1092 | | - platform = "linx64" |
1093 | | - |
1094 | | - if self.dynatype in "intelmpi": |
1095 | | - intel_cmp_rev = "2019.5.281" |
1096 | | - intel_mkl_rev = "2020.0.166" |
1097 | | - intel_mpi_rev = "2018.3.210" |
1098 | | - |
1099 | | - if os.getenv("MPI_ROOT"): |
1100 | | - LOGGER.warning( |
1101 | | - "MPI_ROOT already defined. Not trying to automatically set MPI env variables." |
1102 | | - ) |
1103 | | - return |
1104 | | - |
1105 | | - for root in ansys_env_roots: |
1106 | | - mpi_root = os.path.join( |
1107 | | - os.getenv(root), |
1108 | | - "commonfiles", |
1109 | | - "MPI", |
1110 | | - "Intel", |
1111 | | - intel_mpi_rev, |
1112 | | - platform, |
1113 | | - ) |
1114 | | - mpi_path = os.path.join(mpi_root, "bin") |
1115 | | - mkl_path = os.path.join(os.getenv(root), "tp", "IntelMKL", intel_mkl_rev, platform) |
1116 | | - cmp_path = os.path.join( |
1117 | | - os.getenv(root), "tp", "IntelCompiler", intel_cmp_rev, platform |
1118 | | - ) |
1119 | | - for p in [mpi_root, mpi_path, mkl_path, cmp_path]: |
1120 | | - if not os.path.isdir(p): |
1121 | | - LOGGER.debug("Failed to set env variables with %s " % root) |
1122 | | - continue |
1123 | | - |
1124 | | - LOGGER.info("Setting MPI environment variable MPI_ROOT to %s" % mpi_root) |
1125 | | - LOGGER.info("Adding %s to PATH" % [mpi_path, mkl_path, cmp_path]) |
1126 | | - |
1127 | | - os.environ["MPI_ROOT"] = mpi_root |
1128 | | - os.environ["PATH"] = ( |
1129 | | - ";".join([mpi_path, mkl_path, cmp_path]) + ";" + os.environ["PATH"] |
1130 | | - ) |
1131 | | - os.environ["I_MPI_AUTH_METHOD"] = "delegate" |
1132 | | - os.environ["KMP_AFFINITY"] = "verbose" |
1133 | | - break |
1134 | | - |
1135 | | - elif self.dynatype == "msmpi" and self.platform == "windows": |
1136 | | - intel_cmp_rev = "2019.5.281" |
1137 | | - intel_mkl_rev = "2020.0.166" |
1138 | | - ms_mpi_rev = "10.1.12498.18" |
1139 | | - |
1140 | | - if os.getenv("MPI_ROOT"): |
1141 | | - LOGGER.warning( |
1142 | | - "MPI_ROOT already defined. Not trying to automatically set MPI env variables." |
1143 | | - ) |
1144 | | - return |
1145 | | - |
1146 | | - for root in ansys_env_roots: |
1147 | | - mpi_root = os.path.join( |
1148 | | - os.getenv(root), |
1149 | | - "commonfiles", |
1150 | | - "MPI", |
1151 | | - "Microsoft", |
1152 | | - ms_mpi_rev, |
1153 | | - platform, |
1154 | | - ) |
1155 | | - mpi_path = os.path.join(mpi_root, "bin") |
1156 | | - mkl_path = os.path.join(os.getenv(root), "tp", "IntelMKL", intel_mkl_rev, platform) |
1157 | | - cmp_path = os.path.join( |
1158 | | - os.getenv(root), "tp", "IntelCompiler", intel_cmp_rev, platform |
1159 | | - ) |
1160 | | - for p in [mpi_root, mpi_path, mkl_path, cmp_path]: |
1161 | | - if not os.path.isdir(p): |
1162 | | - LOGGER.debug("Failed to set env variables with %s " % root) |
1163 | | - continue |
1164 | | - |
1165 | | - LOGGER.info("Setting MPI environment variable MPI_ROOT to %s" % mpi_root) |
1166 | | - LOGGER.info("Adding %s to PATH" % [mpi_path, mkl_path, cmp_path]) |
1167 | | - |
1168 | | - os.environ["MPI_ROOT"] = mpi_root |
1169 | | - os.environ["PATH"] = ( |
1170 | | - ";".join([mpi_path, mkl_path, cmp_path]) + ";" + os.environ["PATH"] |
1171 | | - ) |
1172 | | - break |
1173 | | - |
1174 | | - elif self.dynatype == "platformmpi": |
1175 | | - LOGGER.error("Automatically setting env variables for platform mpi not implemented yet") |
1176 | | - return |
1177 | | - |
1178 | | - return |
1179 | | - |
1180 | 1074 | def __repr__(self): |
1181 | 1075 | """Represent self as string.""" |
1182 | 1076 | return yaml.dump(vars(self), allow_unicode=True, default_flow_style=False) |
0 commit comments