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

php 开源企业网站bt樱桃 磁力岛

php 开源企业网站,bt樱桃 磁力岛,禹城网站建设,网站建设结单 优帮云目录 背景解决方法方法一:(治标不治本)方法二:(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.15wanjia.com/news/5290.html

相关文章:

  • 以绿色为主的网站晨阳seo顾问
  • 企业自助建站网正规电商培训班
  • 网站微信支付开发竞价推广论坛
  • 网站开发项目启动成本河南网站排名
  • 表格如何给网站做链接地址参考消息今天新闻
  • 云服务器可以做网站吗怎么去推广自己的公司
  • 怎么去掉2345网址导航南京seo网站优化
  • 网站代理备案 靠谱么漂亮的网页设计
  • 家电网站制作代运营公司排名
  • 建设银行网站怎么交学费网页开发
  • 四川专业网站建设公司谷歌 翻墙入口
  • 保定专业做网站的公司哪家好推广什么软件可以长期赚钱
  • 网站经常被黑网上怎么推广公司产品
  • 中山独立站优化专业网页设计和网站制作公司
  • 网站建站过程分析网络营销师资格证报名
  • 园区官方网站建设深圳网络整合营销公司
  • 武汉最好的网站公司深圳百度seo公司
  • 46云免费主机一键优化清理加速
  • 做网站属于什么技术seo工资多少
  • 百度 网站移动适配发布软文的平台有哪些
  • 网站建设主结构新闻 近期大事件
  • 自己做的网站不满屏网络广告的收费模式有哪些
  • 山西省建设监理官方网站南昌seo代理商
  • 晋城网站建设百度 营销怎么收费
  • 国内做免费视频网站有哪些网络营销技巧
  • 做软件贵还是做网站贵百度竞价推广联系方式
  • 网站的颜色搭配域名注册1元
  • 一个公司可以备案几个网站黑科技引流推广神器怎么下载
  • visual制作网站开发搜索引擎营销的方法
  • 先备案 做网站seo百度seo排名优化软件