GeezerVison is showing github.com — fix(prism): rent 1x B200 on Lium 8x split hosts (#192) · CortexLM/cortex@689154f
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: crates/prism-lium-types/src/json.rs +16Lines changed: 16 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,9 +50,25 @@ pub fn parse_one_offer(item: &Value) -> Option<Offer> { | 50 | 50 | gpu_count, | 51 | 51 | price_per_hour: price, | 52 | 52 | provider: "lium".into(), | | 53 | + min_gpu_count_for_rental: item.get("min_gpu_count_for_rental").and_then(as_u32), | | 54 | + available_gpu_count: item.get("available_gpu_count").and_then(as_u32), | 53 | 55 | }) | 54 | 56 | } | 55 | 57 |
| | 58 | +fn as_u32(v: &Value) -> Option<u32> { | | 59 | + v.as_u64() | | 60 | + .map(|n| n as u32) | | 61 | + .or_else(|| v.as_f64().and_then(finite_u32)) | | 62 | +} | | 63 | + | | 64 | +fn finite_u32(f: f64) -> Option<u32> { | | 65 | + if f.is_finite() && f >= 0.0 && f <= f64::from(u32::MAX) { | | 66 | + Some(f as u32) | | 67 | + } else { | | 68 | + None | | 69 | + } | | 70 | +} | | 71 | + | 56 | 72 | /// Parse a `/pods/{id}` object. | 57 | 73 | #[must_use] | 58 | 74 | pub fn parse_instance(v: &Value, fallback_id: &str) -> Instance { | |
Collapse file Copy file name to clipboardExpand all lines: crates/prism-lium-types/src/types.rs +149-6Lines changed: 149 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,6 +17,26 @@ pub struct Offer { | 17 | 17 | pub price_per_hour: f64, | 18 | 18 | /// Provider label. | 19 | 19 | pub provider: String, | | 20 | + /// Lium GPU-split floor (`min_gpu_count_for_rental`). `None` = omitted. | | 21 | + #[serde(default)] | | 22 | + pub min_gpu_count_for_rental: Option<u32>, | | 23 | + /// Free GPUs on the host (`available_gpu_count`). | | 24 | + #[serde(default)] | | 25 | + pub available_gpu_count: Option<u32>, | | 26 | +} | | 27 | + | | 28 | +impl Default for Offer { | | 29 | + fn default() -> Self { | | 30 | + Self { | | 31 | + id: String::new(), | | 32 | + gpu_type: String::new(), | | 33 | + gpu_count: 1, | | 34 | + price_per_hour: f64::MAX, | | 35 | + provider: "lium".into(), | | 36 | + min_gpu_count_for_rental: None, | | 37 | + available_gpu_count: None, | | 38 | + } | | 39 | + } | 20 | 40 | } | 21 | 41 |
| 22 | 42 | /// Plausible discrete GPU counts on marketplace offers (not SKU numbers). | @@ -122,15 +142,50 @@ impl Offer { | 122 | 142 | effective_gpu_count(self.gpu_count, &self.gpu_type) > 1 | 123 | 143 | } | 124 | 144 |
| | 145 | + /// Lium split: `min ≤ wanted ≤ available`. | | 146 | + /// | | 147 | + /// Idle 8× B200 rows often omit `min_gpu_count_for_rental` while still | | 148 | + /// listing `available_gpu_count` and `price_per_gpu`. Treat that as | | 149 | + /// min=1 so a 1× pin can rent one card — never the whole 8-pack. | | 150 | + /// Missing `available_gpu_count` means "do not infer split". | | 151 | + #[must_use] | | 152 | + pub fn allows_split_for(&self, wanted: u32) -> bool { | | 153 | + if wanted == 0 { | | 154 | + return false; | | 155 | + } | | 156 | + let Some(avail) = self.available_gpu_count else { | | 157 | + return false; | | 158 | + }; | | 159 | + if avail < wanted { | | 160 | + return false; | | 161 | + } | | 162 | + self.min_gpu_count_for_rental.unwrap_or(1) <= wanted | | 163 | + } | | 164 | + | | 165 | + /// GPUs to send on `POST /executors/{id}/rent`. | | 166 | + #[must_use] | | 167 | + pub fn rent_count(&self, requested: u32) -> u32 { | | 168 | + if self.allows_split_for(requested) { | | 169 | + return requested.max(1); | | 170 | + } | | 171 | + let effective = effective_gpu_count(self.gpu_count, &self.gpu_type); | | 172 | + if requested <= 1 { | | 173 | + 1 | | 174 | + } else { | | 175 | + effective.max(requested) | | 176 | + } | | 177 | + } | | 178 | + | 125 | 179 | /// Whether this offer may be rented for `requested` GPUs. | 126 | 180 | /// | 127 | | - /// A 1-GPU request still hard-rejects multi-GPU hosts (live SKU pin). | 128 | | - /// A multi-GPU request accepts a larger host (`effective >= requested`) | 129 | | - /// when no exact-width offer is listed. Lium rejects GPU splitting, so the | 130 | | - /// client rents `gpu_count = effective` (the whole host); the miner caps | 131 | | - /// DDP at the requested width. 8×5090 is never a silent fallback. | | 181 | + /// Accepts an exact-width host, a larger host when `requested > 1`, or a | | 182 | + /// multi-GPU host that advertises (or omits-min) GPU splitting. A 1-GPU | | 183 | + /// pin never takes a non-split 8× pack. 8×5090 is never a silent fallback. | 132 | 184 | #[must_use] | 133 | 185 | pub fn matches_gpu_count(&self, requested: u32) -> bool { | | 186 | + if self.allows_split_for(requested) { | | 187 | + return true; | | 188 | + } | 134 | 189 | let effective = effective_gpu_count(self.gpu_count, &self.gpu_type); | 135 | 190 | if requested <= 1 { | 136 | 191 | return effective == 1; | @@ -547,6 +602,7 @@ mod tests { | 547 | 602 | gpu_count, | 548 | 603 | price_per_hour: price, | 549 | 604 | provider: "lium".into(), | | 605 | + ..Offer::default() | 550 | 606 | }; | 551 | 607 | let pin = mk("1xb200", "NVIDIA B200", 1, 5.5); | 552 | 608 | let eight = mk("8xb200", "NVIDIA B200", 8, 5.6); | @@ -561,13 +617,78 @@ mod tests { | 561 | 617 | let mut offers = vec![eight.clone(), rtx.clone(), pro.clone(), pin.clone()]; | 562 | 618 | pref.filter_sort_offers(&mut offers, 1); | 563 | 619 | let ids: Vec<&str> = offers.iter().map(|o| o.id.as_str()).collect(); | 564 | | - assert_eq!(ids, ["1xb200"], "exact 1× B200 only; never 5090 or 8× B200"); | | 620 | + assert_eq!( | | 621 | + ids, | | 622 | + ["1xb200"], | | 623 | + "exact 1× B200 only; never 5090 or unlabeled 8× B200" | | 624 | + ); | 565 | 625 | assert!(pin.matches_gpu_count(1)); | 566 | 626 | assert!(!eight.matches_gpu_count(1)); | 567 | 627 | assert!(!pref.matches_pin(&rtx.gpu_type)); | 568 | 628 | assert!(!pref.matches_pin(&pro.gpu_type)); | 569 | 629 | } | 570 | 630 |
| | 631 | + #[test] | | 632 | + fn one_gpu_b200_accepts_lium_split_and_idle_8x() { | | 633 | + let native = Offer { | | 634 | + id: "1xb200".into(), | | 635 | + gpu_type: "NVIDIA B200".into(), | | 636 | + gpu_count: 1, | | 637 | + price_per_hour: 5.5, | | 638 | + ..Offer::default() | | 639 | + }; | | 640 | + let split8 = Offer { | | 641 | + id: "8xb200-split".into(), | | 642 | + gpu_type: "NVIDIA B200".into(), | | 643 | + gpu_count: 8, | | 644 | + price_per_hour: 5.6, | | 645 | + min_gpu_count_for_rental: Some(1), | | 646 | + available_gpu_count: Some(4), | | 647 | + ..Offer::default() | | 648 | + }; | | 649 | + let idle8 = Offer { | | 650 | + id: "8xb200-idle".into(), | | 651 | + gpu_type: "NVIDIA B200".into(), | | 652 | + gpu_count: 8, | | 653 | + price_per_hour: 5.85, | | 654 | + available_gpu_count: Some(8), | | 655 | + ..Offer::default() | | 656 | + }; | | 657 | + let whole8 = Offer { | | 658 | + id: "8xb200-whole".into(), | | 659 | + gpu_type: "NVIDIA B200".into(), | | 660 | + gpu_count: 8, | | 661 | + price_per_hour: 5.0, | | 662 | + ..Offer::default() | | 663 | + }; | | 664 | + let min4 = Offer { | | 665 | + id: "8xb200-min4".into(), | | 666 | + gpu_type: "NVIDIA B200".into(), | | 667 | + gpu_count: 8, | | 668 | + price_per_hour: 5.1, | | 669 | + min_gpu_count_for_rental: Some(4), | | 670 | + available_gpu_count: Some(8), | | 671 | + ..Offer::default() | | 672 | + }; | | 673 | + assert!(split8.allows_split_for(1)); | | 674 | + assert!(idle8.allows_split_for(1)); | | 675 | + assert_eq!(split8.rent_count(1), 1); | | 676 | + assert_eq!(idle8.rent_count(1), 1); | | 677 | + assert!(split8.matches_gpu_count(1)); | | 678 | + assert!(idle8.matches_gpu_count(1)); | | 679 | + assert!(!whole8.matches_gpu_count(1)); | | 680 | + assert!(!min4.matches_gpu_count(1)); | | 681 | + let pref = GpuPreference::profile_b200(); | | 682 | + let mut offers = vec![whole8, min4, idle8.clone(), split8.clone(), native.clone()]; | | 683 | + pref.filter_sort_offers(&mut offers, 1); | | 684 | + let ids: Vec<&str> = offers.iter().map(|o| o.id.as_str()).collect(); | | 685 | + assert_eq!( | | 686 | + ids, | | 687 | + ["1xb200", "8xb200-split", "8xb200-idle"], | | 688 | + "native 1× first, then split/idle 8× rented as 1" | | 689 | + ); | | 690 | + } | | 691 | + | 571 | 692 | #[test] | 572 | 693 | fn four_gpu_request_matches_only_four_gpu_offers() { | 573 | 694 | let mk = |id: &str, gpu_type: &str, gpu_count: u32, price: f64| Offer { | @@ -576,6 +697,7 @@ mod tests { | 576 | 697 | gpu_count, | 577 | 698 | price_per_hour: price, | 578 | 699 | provider: "lium".into(), | | 700 | + ..Offer::default() | 579 | 701 | }; | 580 | 702 | let one = mk("1x", "NVIDIA GeForce RTX 5090", 1, 2.0); | 581 | 703 | let four = mk("4x", "NVIDIA GeForce RTX 5090", 4, 1.0); | @@ -618,6 +740,7 @@ mod tests { | 618 | 740 | gpu_count, | 619 | 741 | price_per_hour: price, | 620 | 742 | provider: "lium".into(), | | 743 | + ..Offer::default() | 621 | 744 | }; | 622 | 745 | let two_6000 = mk( | 623 | 746 | "2x6000", | @@ -655,20 +778,23 @@ mod tests { | 655 | 778 | gpu_count: 1, | 656 | 779 | price_per_hour: 2.0, | 657 | 780 | provider: "lium".into(), | | 781 | + ..Offer::default() | 658 | 782 | }; | 659 | 783 | let eight = Offer { | 660 | 784 | id: "8x".into(), | 661 | 785 | gpu_type: "NVIDIA GeForce RTX 5090".into(), | 662 | 786 | gpu_count: 8, | 663 | 787 | price_per_hour: 0.48, | 664 | 788 | provider: "lium".into(), | | 789 | + ..Offer::default() | 665 | 790 | }; | 666 | 791 | let eight_label = Offer { | 667 | 792 | id: "8x-label".into(), | 668 | 793 | gpu_type: "8x RTX 5090".into(), | 669 | 794 | gpu_count: 1, // lying field; label wins | 670 | 795 | price_per_hour: 0.48, | 671 | 796 | provider: "lium".into(), | | 797 | + ..Offer::default() | 672 | 798 | }; | 673 | 799 | assert!(single.matches_gpu_count(1)); | 674 | 800 | assert!(!eight.matches_gpu_count(1)); | @@ -741,6 +867,23 @@ mod tests { | 741 | 867 | assert!(v.telemetry.is_some()); | 742 | 868 | } | 743 | 869 |
| | 870 | + #[test] | | 871 | + fn parse_live_idle_8x_b200_is_one_gpu_rent() { | | 872 | + let v = serde_json::json!({ | | 873 | + "id": "cb5e952f-bcb4-46ff-b7ae-16fc0118b30a", | | 874 | + "machine_name": "NVIDIA B200", | | 875 | + "gpu_count": 8, | | 876 | + "available_gpu_count": 8, | | 877 | + "min_gpu_count_for_rental": null, | | 878 | + "price_per_gpu": 5.85 | | 879 | + }); | | 880 | + let o = crate::parse_one_offer(&v).expect("offer"); | | 881 | + assert_eq!(o.gpu_type, "NVIDIA B200"); | | 882 | + assert!((o.price_per_hour - 5.85).abs() < 1e-9); | | 883 | + assert!(o.matches_gpu_count(1)); | | 884 | + assert_eq!(o.rent_count(1), 1); | | 885 | + } | | 886 | + | 744 | 887 | #[test] | 745 | 888 | fn remote_exec_result_v2_fields_default_absent() { | 746 | 889 | // Mixed-version payloads (e.g. metrics_version set, other v2 keys | |
Collapse file Copy file name to clipboardExpand all lines: crates/prism-lium/src/client.rs +25-6Lines changed: 25 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -789,12 +789,9 @@ impl EvalJobBackend for LiumClient { | 789 | 789 | } | 790 | 790 | let effective = | 791 | 791 | prism_lium_types::effective_gpu_count(selected.gpu_count, &selected.gpu_type); | 792 | | - // 1-GPU rents 1; else whole host (no split). Never 8×5090 fallback. | 793 | | - let rent_gpu_count = if spec.gpu_count <= 1 { | 794 | | - 1 | 795 | | - } else { | 796 | | - effective.max(spec.gpu_count) | 797 | | - }; | | 792 | + // Split hosts: requested width (1× B200 on an 8× node). | | 793 | + // Non-split: 1-GPU stays 1; else whole host. Never 8×5090 fallback. | | 794 | + let rent_gpu_count = selected.rent_count(spec.gpu_count); | 798 | 795 | if pref.matches_pin("RTX 5090") && rent_gpu_count >= 8 && spec.gpu_count < 8 { | 799 | 796 | return Err(LiumError::Api(format!( | 800 | 797 | "abort: refusing {rent_gpu_count}× 5090 rent (no 8×5090 fallback)" | @@ -1296,6 +1293,28 @@ mod tests { | 1296 | 1293 | assert_eq!(inst.id, "pod-1x"); | 1297 | 1294 | } | 1298 | 1295 |
| | 1296 | + #[tokio::test] | | 1297 | + async fn provision_rents_one_gpu_on_idle_8x_b200() { | | 1298 | + let server = MockServer::start().await; | | 1299 | + mount_common( | | 1300 | + &server, | | 1301 | + serde_json::json!([ | | 1302 | + { | | 1303 | + "id": "eight-b200-idle", | | 1304 | + "machine_name": "NVIDIA B200", | | 1305 | + "gpu_count": 8, | | 1306 | + "available_gpu_count": 8, | | 1307 | + "price_per_gpu": 5.85 | | 1308 | + } | | 1309 | + ]), | | 1310 | + ) | | 1311 | + .await; | | 1312 | + mount_rent_path(&server, "eight-b200-idle", "pod-split-1").await; | | 1313 | + let c = LiumClient::with_base_url("test-key", server.uri()).unwrap(); | | 1314 | + let inst = c.provision(&provision_spec()).await.unwrap(); | | 1315 | + assert_eq!(inst.id, "pod-split-1"); | | 1316 | + } | | 1317 | + | 1299 | 1318 | #[tokio::test] | 1300 | 1319 | async fn provision_rejects_all_multi_gpu_offers() { | 1301 | 1320 | let server = MockServer::start().await; | |
Collapse file Copy file name to clipboardExpand all lines: crates/prism-lium/src/sim.rs +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -52,6 +52,7 @@ impl EvalJobBackend for SimLiumBackend { | 52 | 52 | gpu_count: 1, | 53 | 53 | price_per_hour: price, | 54 | 54 | provider: "sim".into(), | | 55 | + ..Offer::default() | 55 | 56 | }; | 56 | 57 | let mut offers = vec![ | 57 | 58 | mk("sim-blackwell", "NVIDIA RTX BLACKWELL B200", 1.2), | |
Collapse file Copy file name to clipboardExpand all lines: crates/prism-verda/src/lib.rs +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -487,6 +487,7 @@ impl EvalJobBackend for VerdaClient { | 487 | 487 | gpu_count: 1, | 488 | 488 | price_per_hour: 0.0, | 489 | 489 | provider: "verda".into(), | | 490 | + ..Offer::default() | 490 | 491 | }) | 491 | 492 | }) | 492 | 493 | .collect()) | |
Collapse file Copy file name to clipboardExpand all lines: docs/PRISM.md +9-4Lines changed: 9 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -954,16 +954,21 @@ overridable Docker `CMD` so the provider bootstrap can run. | 954 | 954 | **GPU profiles + netns contract.** Lium profiles, never mixed in one job: | 955 | 955 |
| 956 | 956 | 1. **Default / 1B dense:** `PRISM_POD_GPU_COUNT=1` + name match **NVIDIA B200** | 957 | | - (needles `B200`, `NVIDIA B200`). Exact 1× only — **do not** fall through to | 958 | | - 8× B200, 5090, or RTX PRO 6000. ~180–192 GB → dense-1b uses mb≥8, | | 957 | + (needles `B200`, `NVIDIA B200`). Rent **one** GPU: a native 1× offer, or an | | 958 | + 8× B200 host that advertises Lium GPU splitting (`min_gpu_count_for_rental` | | 959 | + ≤ 1 ≤ `available_gpu_count`, or omitted `min` with `available ≥ 1` on idle | | 960 | + hosts). Do **not** buy the whole 8-pack, and do **not** fall through to | | 961 | + 5090 or RTX PRO 6000. ~180–192 GB → dense-1b uses mb≥8, | 959 | 962 | `DENSE1B_TE=1` default, checkpoint off, DDP world=1. | 960 | 963 | 2. **Explicit env fallbacks:** `PRISM_POD_GPU_COUNT=4` + **RTX 5090** (exact | 961 | 964 | 4×; **do not** fall through to 8×5090). `PRISM_POD_GPU_COUNT=2` or `8` + | 962 | 965 | **RTX PRO 6000 Blackwell** (Server Edition). ~96 GB/card → mb≥4, TE on, | 963 | 966 | checkpoint off. | 964 | 967 |
| 965 | | -Lium inventory snapshot (2026-08-19): **1× NVIDIA B200** listed at | 966 | | -**$5.50/gpu-hr** (two offers). 8× B200 @ $5.60/gpu-hr is **not** the pin. | | 968 | +Lium inventory snapshot (2026-08-22): marketplace lists **8× NVIDIA B200** | | 969 | +hosts at **$5.60–$6.53/gpu-hr**. Native 1× B200 is often empty; the pin | | 970 | +rents `gpu_count=1` on those 8× rows. A non-split 8× pack (no | | 971 | +`available_gpu_count`) is **not** the pin. | 967 | 972 | RTX PRO 6000 Server Edition remains an env fallback (1× @ $1.29; 8× @ | 968 | 973 | $1.01–$1.85). Ada “RTX 6000” is **not** the 6000 pin. Do **not** treat a | 969 | 974 | 5090 as a B200. | |
|