当前位置: 首页 > news >正文

绿叶网站怎么做荆州网站建设价格

绿叶网站怎么做,荆州网站建设价格,旅游网站建设目标分析,电商自学网1. 硬盘 <-> CPU 数据传输速度 import time import os# 定义文件大小和测试文件路径 file_size 1 * 1024 * 1024 * 100 # 100 MB 的文件大小 file_path "test_file.bin"# 创建一个测试文件并测量写入速度 def test_write_speed():data os.urandom(file_si…

1. 硬盘 <-> CPU 数据传输速度

import time
import os# 定义文件大小和测试文件路径
file_size = 1 * 1024 * 1024 * 100  # 100 MB 的文件大小
file_path = "test_file.bin"# 创建一个测试文件并测量写入速度
def test_write_speed():data = os.urandom(file_size)  # 生成随机数据start_time = time.time()  # 记录开始时间with open(file_path, 'wb') as f:f.write(data)end_time = time.time()  # 记录结束时间write_time = end_time - start_timewrite_speed = file_size / (write_time * 1024 * 1024)  # 转换为 MB/sprint(f"Disk write speed: {write_speed:.6f} MB/s")# 测试硬盘读取速度
def test_read_speed():start_time = time.time()  # 记录开始时间with open(file_path, 'rb') as f:data = f.read()end_time = time.time()  # 记录结束时间read_time = end_time - start_timeread_speed = file_size / (read_time * 1024 * 1024)  # 转换为 MB/sprint(f"Disk read speed: {read_speed:.6f} MB/s")# 进行测试
test_write_speed()
test_read_speed()# 删除测试文件
os.remove(file_path)

2. CPU <-> GPU 数据传输速度

import torch
import time# 设置设备
device_cpu = torch.device('cpu')
device_gpu = torch.device('cuda' if torch.cuda.is_available() else 'cpu')# 创建一个随机张量在 CPU 上
size = 10**7  # 可以根据需要调整大小,元素数量
data_cpu = torch.randn(size).to(device_cpu)# 计算数据大小,假设是 float32 类型,每个元素 4 字节
data_size_bytes = data_cpu.nelement() * data_cpu.element_size()# 测量 CPU -> GPU 传输时间
start_time = time.time()
data_gpu = data_cpu.to(device_gpu)
torch.cuda.synchronize()  # 确保 GPU 操作完成
cpu_to_gpu_time = time.time() - start_time# 计算传输速度 (MB/s)
cpu_to_gpu_speed = data_size_bytes / (cpu_to_gpu_time * 1024 * 1024)  # 转换为 MB/s
print(f"CPU -> GPU data transfer speed: {cpu_to_gpu_speed:.6f} MB/s")# 测量 GPU -> CPU 传输时间
start_time = time.time()
data_back_to_cpu = data_gpu.to(device_cpu)
torch.cuda.synchronize()  # 确保 GPU 操作完成
gpu_to_cpu_time = time.time() - start_time# 计算传输速度 (MB/s)
gpu_to_cpu_speed = data_size_bytes / (gpu_to_cpu_time * 1024 * 1024)  # 转换为 MB/s
print(f"GPU -> CPU data transfer speed: {gpu_to_cpu_speed:.6f} MB/s")
http://www.yayakq.cn/news/161320/

相关文章:

  • 杨和网站设计做任务打字赚钱的网站
  • 设计的网站源代码怎么做自己建设网站流程
  • 进一步网站建设做基金哪个网站好
  • 网站后台发布文章莱芜都市网二手
  • 网站自适应手机代码wordpress 公司建站
  • 泉州网站建设qzdzi建电影网站赚钱挣钱吗
  • 免费可商用的素材网站做电子请帖网站有哪些
  • 潮动九州网站建设网络营销工具及其特点
  • 网站建设策划书提纲有趣的网站官网
  • 网站建设与维护中国出版社小说阅读网站开发源码
  • 做移动端网站软件系统优化大师官方下载
  • 网站开发需要的学历wordpress怎么固定导航栏
  • 成都网站建设网络公司各种资源都有的搜索引擎
  • 网站备案 新闻审批号wordpress的登录页面模板
  • 网站开发实战wordpress降低数据库查询时间
  • 网站模版 百度云网站备案 接入商名称
  • 网站seo入门企业网站制作公司盈利
  • 网站优化搜索网站运营一般做那些分析
  • dw可以做网站吗国家林业建设工程协会网站
  • 重庆大足网站制作公司哪家专业天津塘沽爆炸
  • 做竞猜网站犯法吗中国icp备案网站
  • 怎么做网站策划中国网新山东
  • 常德政务网站阿里云的虚拟主机用什么做网站
  • 什么做网站的公司好高大上网站
  • 潍坊做电商的网站wordpress分享有图片
  • 网站建设咨询哪家性价比高网站建设费用详细表
  • 合理规划网站结构wordpress 小米商城模板
  • 网站开发工具教程免费网站app下载
  • 中小学网站建站模板石家庄抖音推广公司
  • 外发加工网站网站后台网址后缀