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

php 开源企业网站培训心得体会100字

php 开源企业网站,培训心得体会100字,网站可以做二维码导航,深圳做外贸网站公司目录 背景解决方法方法一:(治标不治本)方法二:(triton-windows)- 安装 MSVC 和 Windows SDK- vcredist 安装- whl 安装- 验证 背景 triton 目前官方只有Linux 版本,若未安装,则会出…

目录

  • 背景
  • 解决方法
    • 方法一:(治标不治本)
    • 方法二:(triton-windows)
      • - 安装 MSVC 和 Windows SDK
      • - vcredist 安装
      • - whl 安装
      • - 验证

背景

triton 目前官方只有Linux 版本,若未安装,则会出现报错:

ModuleNotFoundError: No module named 'triton'

在 Windows 系统中,如果直接用 pip install triton 来安装,则会报错:

ERROR: Could not find a version that satisfies the requirement triton (from versions: none)
ERROR: No matching distribution found for triton

解决方法

方法一:(治标不治本)

有大神强行在Windows平台上编译了 triton 的whl,参考博客【window平台安装 triton】【Python|Windows 系统安装 triton 的方法】,在下载路径下 pip install 安装 whl 文件即可。

即直接去 HuggingFace 上下载 triton 的 Windows 包:https://hf-mirror.com/madbuda/triton-windows-builds。

在此给出各个版本的下载链接:

  • 【triton 2.0.0 (Python 3.10)】
  • 【triton 2.1.0 (Python 3.10)】【triton 2.1.0 (Python 3.11)】
  • 【triton 3.0.0(Python 3.10)】【triton 3.0.0(Python 3.11)】【triton 3.0.0(Python 3.12)】

但是,实测上述安装包里面 triton 核心的 triton.jittorch.compile 等功能均无法像Linux下正常运行,上述安装包只是从形式上完成编译。

方法二:(triton-windows)

主要参考大佬的工作:triton-windows。

环境要求:

  1. torch >= 2.4.0
  2. CUDA >=12
  3. 安装 MSVCWindows SDK
  4. 环境需要有 msvcp140.dllvcruntime140.dll。如果
  5. 然后就可以安装他编译的 whl,实现真正的功能。

- 安装 MSVC 和 Windows SDK

参考博客:【Windows 如何仅安装 MSVC 而不安装 Visual Studio】

  1. 下载 Visual Studio Installer,下载地址为:https://aka.ms/vs/17/release/vs_BuildTools.exe。

  2. 运行下载的exe,然后安装单个组件:
    请添加图片描述
    注意只需要下载单个组件,无需安装Visual Studio。

  3. 修改环境变量,请参考博客:【Windows 如何仅安装 MSVC 而不安装 Visual Studio】
    位置为:系统高级设置-环境变量-系统变量。注意修改版本号为你自己的版本

    • 选择 Path ,添加:
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64
      C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x64
    • 添加 LIB,添加3条:
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\lib\x64; C:\Program Files (x86)\Windows Kits\10\Lib\10.0.20348.0\ucrt\x64; C:\Program Files (x86)\Windows Kits\10\Lib\10.0.20348.0\um\x64
    • 添加 INCLUDE,添加6条:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include; C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt; C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\um; C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\winrt; C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\cppwinrt; C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\shared
  4. 验证 MSVC 和 Windows SDK 安装成功
    命令行里输入 cl ,输出 Microsoft (R) C/C++ Optimizing Compiler ... 即可。

- vcredist 安装

vcredist 是必需的(也称为“Visual C++ Redistributable for Visual Studio 2015-2022”,msvcp140.dllvcruntime140.dll)。如果没有,可以从 https://aka.ms/vs/17/release/vc_redist.x64.exe 中安装。

- whl 安装

前期环境都配置无误后,直接下载 whl 安装:

pip install https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp310-cp310-win_amd64.whl

也可手动下载下来然后在下载路径下安装:

pip install triton-3.1.0-cp310-cp310-win_amd64.whl

- 验证

验证脚本为:

import torch
import triton
import triton.language as tl@triton.jit
def add_kernel(x_ptr, y_ptr, output_ptr, n_elements, BLOCK_SIZE: tl.constexpr):pid = tl.program_id(axis=0)block_start = pid * BLOCK_SIZEoffsets = block_start + tl.arange(0, BLOCK_SIZE)mask = offsets < n_elementsx = tl.load(x_ptr + offsets, mask=mask)y = tl.load(y_ptr + offsets, mask=mask)output = x + ytl.store(output_ptr + offsets, output, mask=mask)def add(x: torch.Tensor, y: torch.Tensor):output = torch.empty_like(x)assert x.is_cuda and y.is_cuda and output.is_cudan_elements = output.numel()grid = lambda meta: (triton.cdiv(n_elements, meta["BLOCK_SIZE"]),)add_kernel[grid](x, y, output, n_elements, BLOCK_SIZE=1024)return outputa = torch.rand(3, device="cuda")
b = a + a
b_compiled = add(a, a)
print(b_compiled - b)
print("If you see tensor([0., 0., 0.], device='cuda:0'), then it works")

不报错即说明配置成功。

http://www.shuangfujiaoyu.com/news/51723.html

相关文章:

  • 做公众号可以看的网站查域名
  • 网站建设 bs模式柳州网站建设
  • 医院网站建设运营方案南宁推广公司
  • 济南网站制作哪家好网店如何推广
  • 公司网站手机版网页开发
  • 做网站与不做网站的区别seo概念
  • 做期货看资讯什么网站好seo 优化教程
  • 汕头网站优化本地建站软件有哪些
  • github做网站速度快吗百度指数查询官方网
  • 武汉手机网站建设如何百度竞价代运营公司
  • 知名的中文域名网站游戏推广公司
  • 创建企业营销网站包括哪些内容公司网站免费自建
  • 养殖场网站模板白云区最新疫情
  • 高端网站建设公司名称最好看免费观看高清大全
  • 上海赶集网站建设营销qq下载
  • 优优网站建设公司网络营销岗位有哪些
  • seo指什么关键词智能优化排名
  • 北京的做网站公司安卓手机优化神器
  • 金诚信矿业建设集团有限公司网站网页设计与制作考试试题及答案
  • 上海市政府官方网站seo推广seo技术培训
  • 网站设计基本步骤企业宣传软文
  • wordpress管理账户汕头seo快速排名
  • 做个网站需要什么设备推广广告赚钱软件
  • 网页图片居中怎么设置网络推广优化seo
  • 乐站_网站建设_自助建站网站优化课程培训
  • 深圳专业建站公司技术好seo的方式包括
  • dw如何用表格来做网站优化网站排名推广
  • 交友网站建设开发北京seo优化诊断
  • 做网站电话销售关键词优化公司电话
  • b2c 网站 方案现在推广引流什么平台比较火