Skip to content

Commit f422354

Browse files
colin2328meta-codesync[bot]
authored andcommitted
build monarch_extension as extension-module
Differential Revision: D84956118
1 parent 1a3442a commit f422354

File tree

10 files changed

+17
-10
lines changed

10 files changed

+17
-10
lines changed

controller/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiproces
2727
monarch_messages = { version = "0.0.0", path = "../monarch_messages" }
2828
nccl-sys = { path = "../nccl-sys" }
2929
ndslice = { version = "0.0.0", path = "../ndslice" }
30-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
30+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
3131
serde = { version = "1.0.219", features = ["derive", "rc"] }
3232
serde_json = { version = "1.0.140", features = ["alloc", "float_roundtrip", "raw_value", "unbounded_depth"] }
3333
tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] }

monarch_extension/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ monarch_tensor_worker = { version = "0.0.0", path = "../monarch_tensor_worker",
3434
monarch_types = { version = "0.0.0", path = "../monarch_types" }
3535
nccl-sys = { path = "../nccl-sys", optional = true }
3636
ndslice = { version = "0.0.0", path = "../ndslice" }
37-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
37+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
3838
rdmaxcel-sys = { path = "../rdmaxcel-sys", optional = true }
3939
serde = { version = "1.0.219", features = ["derive", "rc"] }
4040
tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] }

monarch_hyperactor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ndslice = { version = "0.0.0", path = "../ndslice" }
4040
nix = { version = "0.30.1", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] }
4141
once_cell = "1.21"
4242
opentelemetry = "0.29"
43-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
43+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
4444
pyo3-async-runtimes = { version = "0.24", features = ["attributes", "tokio-runtime"] }
4545
serde = { version = "1.0.219", features = ["derive", "rc"] }
4646
serde_bytes = "0.11"

monarch_messages/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum-as-inner = "0.6.0"
1414
hyperactor = { version = "0.0.0", path = "../hyperactor" }
1515
monarch_types = { version = "0.0.0", path = "../monarch_types" }
1616
ndslice = { version = "0.0.0", path = "../ndslice" }
17-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
17+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
1818
serde = { version = "1.0.219", features = ["derive", "rc"] }
1919
serde_bytes = "0.11"
2020
thiserror = "2.0.12"

monarch_rdma/extension/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ hyperactor = { version = "0.0.0", path = "../../hyperactor" }
1818
hyperactor_mesh = { version = "0.0.0", path = "../../hyperactor_mesh" }
1919
monarch_hyperactor = { version = "0.0.0", path = "../../monarch_hyperactor" }
2020
monarch_rdma = { version = "0.0.0", path = ".." }
21-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
21+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
2222
serde = { version = "1.0.219", features = ["derive", "rc"] }
2323
serde_json = { version = "1.0.140", features = ["alloc", "float_roundtrip", "raw_value", "unbounded_depth"] }
2424
tracing = { version = "0.1.41", features = ["attributes", "valuable"] }

monarch_tensor_worker/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ monarch_types = { version = "0.0.0", path = "../monarch_types" }
2626
ndslice = { version = "0.0.0", path = "../ndslice" }
2727
nix = { version = "0.30.1", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] }
2828
parking_lot = { version = "0.12.1", features = ["send_guard"] }
29-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
29+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
3030
serde = { version = "1.0.219", features = ["derive", "rc"] }
3131
serde_json = { version = "1.0.140", features = ["alloc", "float_roundtrip", "raw_value", "unbounded_depth"] }
3232
sorted-vec = "0.8.3"

monarch_types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ license = "BSD-3-Clause"
1010
[dependencies]
1111
derive_more = { version = "1.0.0", features = ["full"] }
1212
hyperactor = { version = "0.0.0", path = "../hyperactor" }
13-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
13+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
1414
serde = { version = "1.0.219", features = ["derive", "rc"] }
1515
serde_bytes = "0.11"
1616

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ def run(self):
119119
with open("README.md", encoding="utf8") as f:
120120
readme = f.read()
121121

122+
python_lib_dir = sysconfig.get_config_var("LIBDIR") # path to libpython3.10.so.1.0
123+
124+
rust_binding_args = ["--"]
125+
if not USE_TENSOR_ENGINE:
126+
rust_binding_args.append("--no-default-features")
127+
rust_binding_args += [f"-C", f"link-args=-Wl,-rpath,{python_lib_dir}"]
128+
122129
rust_extensions = [
123130
RustBin(
124131
target="process_allocator",
@@ -131,7 +138,7 @@ def run(self):
131138
path="monarch_extension/Cargo.toml",
132139
debug=False,
133140
features=["tensor_engine"] if USE_TENSOR_ENGINE else [],
134-
args=[] if USE_TENSOR_ENGINE else ["--no-default-features"],
141+
args=rust_binding_args,
135142
),
136143
]
137144

torch-sys-cuda/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cxx = "1.0.119"
1515
derive_more = { version = "1.0.0", features = ["full"] }
1616
fxhash = "0.2.1"
1717
nccl-sys = { path = "../nccl-sys" }
18-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
18+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
1919
serde = { version = "1.0.219", features = ["derive", "rc"] }
2020
thiserror = "2.0.12"
2121
torch-sys = { version = "0.0.0", path = "../torch-sys" }

torch-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ hyperactor = { version = "0.0.0", path = "../hyperactor" }
1919
monarch_types = { version = "0.0.0", path = "../monarch_types" }
2020
nccl-sys = { path = "../nccl-sys", optional = true }
2121
paste = "1.0.14"
22-
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
22+
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
2323
regex = "1.11.1"
2424
serde = { version = "1.0.219", features = ["derive", "rc"] }
2525
thiserror = "2.0.12"

0 commit comments

Comments
 (0)