Add files using upload-large-folder tool
Browse files- URSA/outputs/eval_distill/00_s0_a_lone_grizzly_bear_walks_through_a_mist_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/00_s1_a_lone_grizzly_bear_walks_through_a_mist_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/00_s1_a_lone_grizzly_bear_walks_through_a_mist_teacher_25step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/00_s2_a_lone_grizzly_bear_walks_through_a_mist_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/01_s0_beautiful_fireworks_in_the_sky_with_red__student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/01_s1_beautiful_fireworks_in_the_sky_with_red__student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/01_s2_beautiful_fireworks_in_the_sky_with_red__student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/01_s3_beautiful_fireworks_in_the_sky_with_red__student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/01_s3_beautiful_fireworks_in_the_sky_with_red__student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/01_s3_beautiful_fireworks_in_the_sky_with_red__teacher_25step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/02_s0_a_wave_crashes_on_a_rocky_shoreline_at_s_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/02_s1_a_wave_crashes_on_a_rocky_shoreline_at_s_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/02_s2_a_wave_crashes_on_a_rocky_shoreline_at_s_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/02_s2_a_wave_crashes_on_a_rocky_shoreline_at_s_teacher_25step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/03_s0_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/03_s1_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/03_s1_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/03_s2_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/03_s3_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/03_s3_a_hummingbird_hovers_in_front_of_a_red_f_teacher_25step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/04_s0_timelapse_of_clouds_rolling_over_mountai_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/04_s0_timelapse_of_clouds_rolling_over_mountai_teacher_25step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/04_s1_timelapse_of_clouds_rolling_over_mountai_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/04_s1_timelapse_of_clouds_rolling_over_mountai_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/04_s2_timelapse_of_clouds_rolling_over_mountai_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/04_s2_timelapse_of_clouds_rolling_over_mountai_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/04_s3_timelapse_of_clouds_rolling_over_mountai_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/04_s3_timelapse_of_clouds_rolling_over_mountai_teacher_25step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_teacher_25step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_teacher_25step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s1_a_neonlit_city_street_at_night_with_rain_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s1_a_neonlit_city_street_at_night_with_rain_teacher_25step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s2_a_neonlit_city_street_at_night_with_rain_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/05_s3_a_neonlit_city_street_at_night_with_rain_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s3_a_neonlit_city_street_at_night_with_rain_teacher_25step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/05_s3_a_neonlit_city_street_at_night_with_rain_teacher_25step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/06_s1_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/06_s2_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/06_s3_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/06_s3_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/07_s0_astronaut_floating_weightlessly_inside_a_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/07_s0_astronaut_floating_weightlessly_inside_a_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/07_s1_astronaut_floating_weightlessly_inside_a_student_1step_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/07_s2_astronaut_floating_weightlessly_inside_a_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/07_s2_astronaut_floating_weightlessly_inside_a_student_1step_no_cfg.mp4 +0 -0
- URSA/outputs/eval_distill/07_s3_astronaut_floating_weightlessly_inside_a_student_1step_baked.mp4 +0 -0
- URSA/outputs/eval_distill/07_s3_astronaut_floating_weightlessly_inside_a_teacher_25step_no_cfg.mp4 +0 -0
- gpu_run.py +126 -0
URSA/outputs/eval_distill/00_s0_a_lone_grizzly_bear_walks_through_a_mist_student_1step_baked.mp4
ADDED
|
Binary file (94.9 kB). View file
|
|
|
URSA/outputs/eval_distill/00_s1_a_lone_grizzly_bear_walks_through_a_mist_student_1step_no_cfg.mp4
ADDED
|
Binary file (92.5 kB). View file
|
|
|
URSA/outputs/eval_distill/00_s1_a_lone_grizzly_bear_walks_through_a_mist_teacher_25step_cfg.mp4
ADDED
|
Binary file (98.6 kB). View file
|
|
|
URSA/outputs/eval_distill/00_s2_a_lone_grizzly_bear_walks_through_a_mist_student_1step_baked.mp4
ADDED
|
Binary file (98.1 kB). View file
|
|
|
URSA/outputs/eval_distill/01_s0_beautiful_fireworks_in_the_sky_with_red__student_1step_baked.mp4
ADDED
|
Binary file (95.5 kB). View file
|
|
|
URSA/outputs/eval_distill/01_s1_beautiful_fireworks_in_the_sky_with_red__student_1step_cfg.mp4
ADDED
|
Binary file (93.6 kB). View file
|
|
|
URSA/outputs/eval_distill/01_s2_beautiful_fireworks_in_the_sky_with_red__student_1step_cfg.mp4
ADDED
|
Binary file (98.8 kB). View file
|
|
|
URSA/outputs/eval_distill/01_s3_beautiful_fireworks_in_the_sky_with_red__student_1step_baked.mp4
ADDED
|
Binary file (96 kB). View file
|
|
|
URSA/outputs/eval_distill/01_s3_beautiful_fireworks_in_the_sky_with_red__student_1step_cfg.mp4
ADDED
|
Binary file (94.4 kB). View file
|
|
|
URSA/outputs/eval_distill/01_s3_beautiful_fireworks_in_the_sky_with_red__teacher_25step_no_cfg.mp4
ADDED
|
Binary file (98.7 kB). View file
|
|
|
URSA/outputs/eval_distill/02_s0_a_wave_crashes_on_a_rocky_shoreline_at_s_student_1step_cfg.mp4
ADDED
|
Binary file (94.4 kB). View file
|
|
|
URSA/outputs/eval_distill/02_s1_a_wave_crashes_on_a_rocky_shoreline_at_s_student_1step_no_cfg.mp4
ADDED
|
Binary file (91.3 kB). View file
|
|
|
URSA/outputs/eval_distill/02_s2_a_wave_crashes_on_a_rocky_shoreline_at_s_student_1step_no_cfg.mp4
ADDED
|
Binary file (98.8 kB). View file
|
|
|
URSA/outputs/eval_distill/02_s2_a_wave_crashes_on_a_rocky_shoreline_at_s_teacher_25step_cfg.mp4
ADDED
|
Binary file (99.8 kB). View file
|
|
|
URSA/outputs/eval_distill/03_s0_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_cfg.mp4
ADDED
|
Binary file (95.4 kB). View file
|
|
|
URSA/outputs/eval_distill/03_s1_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_cfg.mp4
ADDED
|
Binary file (94.3 kB). View file
|
|
|
URSA/outputs/eval_distill/03_s1_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_no_cfg.mp4
ADDED
|
Binary file (92.9 kB). View file
|
|
|
URSA/outputs/eval_distill/03_s2_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_no_cfg.mp4
ADDED
|
Binary file (98.2 kB). View file
|
|
|
URSA/outputs/eval_distill/03_s3_a_hummingbird_hovers_in_front_of_a_red_f_student_1step_no_cfg.mp4
ADDED
|
Binary file (96.6 kB). View file
|
|
|
URSA/outputs/eval_distill/03_s3_a_hummingbird_hovers_in_front_of_a_red_f_teacher_25step_cfg.mp4
ADDED
|
Binary file (97.1 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s0_timelapse_of_clouds_rolling_over_mountai_student_1step_baked.mp4
ADDED
|
Binary file (92.7 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s0_timelapse_of_clouds_rolling_over_mountai_teacher_25step_no_cfg.mp4
ADDED
|
Binary file (98.7 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s1_timelapse_of_clouds_rolling_over_mountai_student_1step_baked.mp4
ADDED
|
Binary file (91.8 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s1_timelapse_of_clouds_rolling_over_mountai_student_1step_cfg.mp4
ADDED
|
Binary file (89.8 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s2_timelapse_of_clouds_rolling_over_mountai_student_1step_cfg.mp4
ADDED
|
Binary file (96.7 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s2_timelapse_of_clouds_rolling_over_mountai_student_1step_no_cfg.mp4
ADDED
|
Binary file (97.3 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s3_timelapse_of_clouds_rolling_over_mountai_student_1step_no_cfg.mp4
ADDED
|
Binary file (96.7 kB). View file
|
|
|
URSA/outputs/eval_distill/04_s3_timelapse_of_clouds_rolling_over_mountai_teacher_25step_cfg.mp4
ADDED
|
Binary file (97.9 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_student_1step_baked.mp4
ADDED
|
Binary file (94.9 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_student_1step_cfg.mp4
ADDED
|
Binary file (99.4 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_teacher_25step_cfg.mp4
ADDED
|
Binary file (94.4 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s0_a_neonlit_city_street_at_night_with_rain_teacher_25step_no_cfg.mp4
ADDED
|
Binary file (96.2 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s1_a_neonlit_city_street_at_night_with_rain_student_1step_cfg.mp4
ADDED
|
Binary file (95.5 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s1_a_neonlit_city_street_at_night_with_rain_teacher_25step_no_cfg.mp4
ADDED
|
Binary file (93 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s2_a_neonlit_city_street_at_night_with_rain_student_1step_baked.mp4
ADDED
|
Binary file (99.1 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s3_a_neonlit_city_street_at_night_with_rain_student_1step_cfg.mp4
ADDED
|
Binary file (98.6 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s3_a_neonlit_city_street_at_night_with_rain_teacher_25step_cfg.mp4
ADDED
|
Binary file (97.2 kB). View file
|
|
|
URSA/outputs/eval_distill/05_s3_a_neonlit_city_street_at_night_with_rain_teacher_25step_no_cfg.mp4
ADDED
|
Binary file (95.2 kB). View file
|
|
|
URSA/outputs/eval_distill/06_s1_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_no_cfg.mp4
ADDED
|
Binary file (92.5 kB). View file
|
|
|
URSA/outputs/eval_distill/06_s2_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_baked.mp4
ADDED
|
Binary file (97.7 kB). View file
|
|
|
URSA/outputs/eval_distill/06_s3_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_baked.mp4
ADDED
|
Binary file (95.4 kB). View file
|
|
|
URSA/outputs/eval_distill/06_s3_a_kitten_playing_with_a_ball_of_yarn_on__student_1step_cfg.mp4
ADDED
|
Binary file (96.2 kB). View file
|
|
|
URSA/outputs/eval_distill/07_s0_astronaut_floating_weightlessly_inside_a_student_1step_cfg.mp4
ADDED
|
Binary file (93.4 kB). View file
|
|
|
URSA/outputs/eval_distill/07_s0_astronaut_floating_weightlessly_inside_a_student_1step_no_cfg.mp4
ADDED
|
Binary file (95.3 kB). View file
|
|
|
URSA/outputs/eval_distill/07_s1_astronaut_floating_weightlessly_inside_a_student_1step_cfg.mp4
ADDED
|
Binary file (91.2 kB). View file
|
|
|
URSA/outputs/eval_distill/07_s2_astronaut_floating_weightlessly_inside_a_student_1step_baked.mp4
ADDED
|
Binary file (95.9 kB). View file
|
|
|
URSA/outputs/eval_distill/07_s2_astronaut_floating_weightlessly_inside_a_student_1step_no_cfg.mp4
ADDED
|
Binary file (95.9 kB). View file
|
|
|
URSA/outputs/eval_distill/07_s3_astronaut_floating_weightlessly_inside_a_student_1step_baked.mp4
ADDED
|
Binary file (94.1 kB). View file
|
|
|
URSA/outputs/eval_distill/07_s3_astronaut_floating_weightlessly_inside_a_teacher_25step_no_cfg.mp4
ADDED
|
Binary file (94.7 kB). View file
|
|
|
gpu_run.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gpu_run.py
|
| 2 |
+
# 用法:
|
| 3 |
+
# python gpu_run.py
|
| 4 |
+
# python gpu_run.py --target 0.6 --duration 0
|
| 5 |
+
# CUDA_VISIBLE_DEVICES=0,1 python gpu_run.py --target 0.6 --size 4096 --streams 4
|
| 6 |
+
#
|
| 7 |
+
# 说明:
|
| 8 |
+
# - 目标是把每张可见 GPU 的平均利用率维持在大约 target(默认 60%)
|
| 9 |
+
# - 原理:每个周期里“忙一会儿 + 休一会儿”,让 nvidia-smi 统计窗口看到约 60% 的利用率
|
| 10 |
+
# - 不同显卡/驱动/CUDA 版本会有偏差;要更接近 60%,优先调 --size 和 --cycle-ms
|
| 11 |
+
|
| 12 |
+
import argparse
|
| 13 |
+
import threading
|
| 14 |
+
import time
|
| 15 |
+
import torch
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def worker(
|
| 19 |
+
gpu_id: int,
|
| 20 |
+
target: float,
|
| 21 |
+
duration: float,
|
| 22 |
+
size: int,
|
| 23 |
+
streams: int,
|
| 24 |
+
cycle_ms: int,
|
| 25 |
+
):
|
| 26 |
+
device = f"cuda:{gpu_id}"
|
| 27 |
+
torch.cuda.set_device(device)
|
| 28 |
+
torch.backends.cuda.matmul.allow_tf32 = True
|
| 29 |
+
torch.set_float32_matmul_precision("high")
|
| 30 |
+
|
| 31 |
+
# 用 FP16/BF16 大矩阵乘法制造稳定算力负载
|
| 32 |
+
# 如果你的卡不太适合 fp16,也可改成 torch.float32
|
| 33 |
+
dtype = torch.float16
|
| 34 |
+
if torch.cuda.get_device_capability(gpu_id)[0] >= 8:
|
| 35 |
+
# Ampere/Hopper 往往 BF16 也很稳
|
| 36 |
+
dtype = torch.bfloat16
|
| 37 |
+
|
| 38 |
+
# 为每个 stream 预分配张量,避免循环中频繁申请显存
|
| 39 |
+
cuda_streams = [torch.cuda.Stream(device=device) for _ in range(streams)]
|
| 40 |
+
tensors = []
|
| 41 |
+
for _ in range(streams):
|
| 42 |
+
a = torch.randn((size, size), device=device, dtype=dtype)
|
| 43 |
+
b = torch.randn((size, size), device=device, dtype=dtype)
|
| 44 |
+
tensors.append((a, b))
|
| 45 |
+
|
| 46 |
+
# 预热
|
| 47 |
+
for s, (a, b) in zip(cuda_streams, tensors):
|
| 48 |
+
with torch.cuda.stream(s):
|
| 49 |
+
for _ in range(4):
|
| 50 |
+
_ = a @ b
|
| 51 |
+
torch.cuda.synchronize(device)
|
| 52 |
+
|
| 53 |
+
busy_ms = max(1, int(cycle_ms * target))
|
| 54 |
+
idle_ms = max(0, cycle_ms - busy_ms)
|
| 55 |
+
|
| 56 |
+
start = time.time()
|
| 57 |
+
end_time = start + duration if duration > 0 else float("inf")
|
| 58 |
+
|
| 59 |
+
print(
|
| 60 |
+
f"[GPU {gpu_id}] start | target={target:.2f}, size={size}, streams={streams}, "
|
| 61 |
+
f"cycle={cycle_ms}ms, busy={busy_ms}ms, idle={idle_ms}ms, dtype={dtype}"
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
while time.time() < end_time:
|
| 65 |
+
t0 = time.time()
|
| 66 |
+
|
| 67 |
+
# busy phase:在设定时间内持续发 matmul
|
| 68 |
+
while (time.time() - t0) * 1000 < busy_ms:
|
| 69 |
+
for s, (a, b) in zip(cuda_streams, tensors):
|
| 70 |
+
with torch.cuda.stream(s):
|
| 71 |
+
_ = a @ b
|
| 72 |
+
|
| 73 |
+
# 确保本轮计算真正执行完,避免堆积过多 kernel
|
| 74 |
+
torch.cuda.synchronize(device)
|
| 75 |
+
|
| 76 |
+
# idle phase:CPU sleep,让 GPU 闲下来,形成平均 60% 利用率
|
| 77 |
+
if idle_ms > 0:
|
| 78 |
+
time.sleep(idle_ms / 1000.0)
|
| 79 |
+
|
| 80 |
+
torch.cuda.synchronize(device)
|
| 81 |
+
print(f"[GPU {gpu_id}] done")
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def main():
|
| 85 |
+
parser = argparse.ArgumentParser()
|
| 86 |
+
parser.add_argument("--target", type=float, default=0.6, help="目标平均利用率,默认 0.6")
|
| 87 |
+
parser.add_argument("--duration", type=float, default=0, help="运行秒数;0 表示一直跑")
|
| 88 |
+
parser.add_argument("--size", type=int, default=4096, help="矩阵边长,默认 4096")
|
| 89 |
+
parser.add_argument("--streams", type=int, default=4, help="每张卡并发 stream 数,默认 4")
|
| 90 |
+
parser.add_argument("--cycle-ms", type=int, default=1000, help="占空比周期,默认 1000ms")
|
| 91 |
+
args = parser.parse_args()
|
| 92 |
+
|
| 93 |
+
if not torch.cuda.is_available():
|
| 94 |
+
raise RuntimeError("没有检测到 CUDA GPU。")
|
| 95 |
+
|
| 96 |
+
if not (0 < args.target <= 1.0):
|
| 97 |
+
raise ValueError("--target 必须在 (0, 1] 内")
|
| 98 |
+
|
| 99 |
+
num_gpus = torch.cuda.device_count()
|
| 100 |
+
print(f"Detected {num_gpus} visible GPU(s)")
|
| 101 |
+
for i in range(num_gpus):
|
| 102 |
+
print(f" GPU {i}: {torch.cuda.get_device_name(i)}")
|
| 103 |
+
|
| 104 |
+
threads = []
|
| 105 |
+
for gpu_id in range(num_gpus):
|
| 106 |
+
t = threading.Thread(
|
| 107 |
+
target=worker,
|
| 108 |
+
args=(
|
| 109 |
+
gpu_id,
|
| 110 |
+
args.target,
|
| 111 |
+
args.duration,
|
| 112 |
+
args.size,
|
| 113 |
+
args.streams,
|
| 114 |
+
args.cycle_ms,
|
| 115 |
+
),
|
| 116 |
+
daemon=False,
|
| 117 |
+
)
|
| 118 |
+
t.start()
|
| 119 |
+
threads.append(t)
|
| 120 |
+
|
| 121 |
+
for t in threads:
|
| 122 |
+
t.join()
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
if __name__ == "__main__":
|
| 126 |
+
main()
|