MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / ncu_test

Function ncu_test

src/fused_mm_sampling/modal_lib/modal_ncu_test.py:9–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8@app.function(gpu="B200", image=make_image())
9def ncu_test():
10 script = """
11import torch
12
13a = torch.randn(1024, 1024, device="cuda", dtype=torch.bfloat16)
14b = torch.randn(1024, 1024, device="cuda", dtype=torch.bfloat16)
15torch.cuda.synchronize()
16c = a + b
17torch.cuda.synchronize()
18"""
19 with open("/tmp/ncu_kernel.py", "w") as f:
20 f.write(script)
21
22 result = subprocess.run(
23 [
24 "ncu",
25 "--target-processes",
26 "all",
27 "--set",
28 "basic",
29 "python",
30 "/tmp/ncu_kernel.py",
31 ],
32 capture_output=True,
33 text=True,
34 )
35 print("=== stdout ===")
36 print(result.stdout[-3000:] if len(result.stdout) > 3000 else result.stdout)
37 print("=== stderr ===")
38 print(result.stderr[-3000:] if len(result.stderr) > 3000 else result.stderr)
39 print(f"=== returncode: {result.returncode} ===")
40
41
42@app.local_entrypoint()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected