MCPcopy
hub / github.com/deepspeedai/DeepSpeed / validate_torch_op_version

Method validate_torch_op_version

op_builder/builder.py:164–182  ·  view source on GitHub ↗
(torch_info)

Source from the content-addressed store, hash-verified

162
163 @staticmethod
164 def validate_torch_op_version(torch_info):
165 if not OpBuilder.is_rocm_pytorch():
166 current_cuda_version = ".".join(torch.version.cuda.split('.')[:2])
167 install_cuda_version = torch_info['cuda_version']
168 if install_cuda_version != current_cuda_version:
169 raise RuntimeError("CUDA version mismatch! DeepSpeed ops were compiled and installed "
170 "with a different version than what is being used at runtime. "
171 f"Please re-install DeepSpeed or switch torch versions. "
172 f"Install CUDA version={install_cuda_version}, "
173 f"Runtime CUDA version={current_cuda_version}")
174 else:
175 current_hip_version = ".".join(torch.version.hip.split('.')[:2])
176 install_hip_version = torch_info['hip_version']
177 if install_hip_version != current_hip_version:
178 raise RuntimeError("HIP version mismatch! DeepSpeed ops were compiled and installed "
179 "with a different version than what is being used at runtime. "
180 f"Please re-install DeepSpeed or switch torch versions. "
181 f"Install HIP version={install_hip_version}, "
182 f"Runtime HIP version={current_hip_version}")
183
184 @staticmethod
185 def is_rocm_pytorch():

Callers 1

loadMethod · 0.95

Calls 1

is_rocm_pytorchMethod · 0.80

Tested by

no test coverage detected