本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。 ====== 强行占用20G的显存 ====== 因为某些特定的原因,我们必须占用 30% 的显存 <code python use_gpu.py> import torch import time device = torch.device("cuda") total_memory = torch.cuda.get_device_properties(0).total_memory target_memory = total_memory * 0.3 num_elements = int(target_memory / 4) tensor = torch.randn(num_elements, dtype=torch.float32, device=device) time.sleep(3600000000) del tensor torch.cuda.empty_cache() </code>