Skip to content

Commit 2c48fe4

Browse files
committed
Add copy_libuv_to_torch_lib so we shm.dll can find libuv at runtime
1 parent 16b0838 commit 2c48fe4

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

external-builds/pytorch/build_prod_wheels.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,18 @@ def copy_msvc_libomp_to_torch_lib(pytorch_dir: Path):
925925
shutil.copy2(omp_path, target_lib)
926926

927927

928+
def copy_libuv_to_torch_lib(pytorch_dir: Path):
929+
libuv_root = os.environ.get("libuv_ROOT", "")
930+
if not libuv_root:
931+
return
932+
uv_dll = Path(libuv_root) / "bin" / "uv.dll"
933+
if not uv_dll.exists():
934+
raise RuntimeError(f"Did not find uv.dll at '{uv_dll}'")
935+
target_lib = pytorch_dir / "torch" / "lib"
936+
print(f"Copying libuv from '{uv_dll}' to '{target_lib}'")
937+
shutil.copy2(uv_dll, target_lib)
938+
939+
928940
def do_build_pytorch(
929941
args: argparse.Namespace,
930942
pytorch_dir: Path,
@@ -1054,6 +1066,7 @@ def do_build_pytorch(
10541066
# Windows-specific settings.
10551067
if is_windows:
10561068
copy_msvc_libomp_to_torch_lib(pytorch_dir)
1069+
copy_libuv_to_torch_lib(pytorch_dir)
10571070

10581071
use_flash_attention = (
10591072
"1"

0 commit comments

Comments
 (0)