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

cuda-12.4.0 devel docker 中源码安装 OpenAI triton

 0,宿主机安装cuda sdk 和 kmd dirver 等

可参考 nv official docs;

1,准备 docker 容器

下载docker image:
 

$ sudo docker pull nvidia/cuda:12.6.2-devel-ubuntu20.04

创建容器:
 

sudo docker run --gpus all -it --name cuda_LHL_01  -v /home/hongleili/ex_triton/tmp1:/root/ex_triton/tmp1   nvidia/cuda:12.6.2-devel-ubuntu20.04

2,安装 git vim python3 wget pip


 

apt-get update
apt install git vim python3 wget
apt install python3-pip


3, 源码安装 cmake

# apt install libssl-dev
# git clone https://github.com/Kitware/CMake.git
# cd CMake/
# git checkout v3.31.6./bootstrap
make -j
make install


4, 安装 pybind11


 

pip install ninja cmake wheel pybind11  -i https://pypi.tuna.tsinghua.edu.cn/simple

5, 下载 triton

git clone https://github.com/triton-lang/triton.gitcd triton/git checkout v2.1.0pip install -e python

安装:

pip install -e python  -i https://pypi.tuna.tsinghua.edu.cn/simple

成功提示如下,

 下图这个输出会停留较长时间,

6,安装 pytorch

查找 torch 的 pip 网址:

https://pypi.org/search

安装 torch:

不指定 cuda 版本,

pip install torch==2.4.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

指定 cuda 版本为12.6,

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126

也可以从源码安装 torch

7,测试 triton 环境

基本原则:

1)Triton 目前只支持 PyTorch 算子融合, 所以在使用triton时,需要事先import torch 包;
2)在 核函数 中, 我们只能使用 tl 中提供的关键字和函数, 或者被 triton.jit 装饰过的函数(类似 __device__ 修饰),不能调用其他 triton 或 pytorch 等的函数;
3)而在 核函数 之外, 可以使用 triton 提供的函数,但是,不能使用 tl 中提供的函数;


http://www.mrgr.cn/news/92888.html

相关文章:

  • 代码随想录算法训练营第三十天 | 卡码网46.携带研究材料(二维解法)、卡码网46.携带研究材料(滚动数组)、LeetCode416.分割等和子集
  • 自然语言处理:文本表示
  • Linux系统服务安全检测手记
  • 本地搭建Ollama运行各种平台的大模型(deepseek),配合AnythingLLM-UI界面使用
  • 【漫话机器学习系列】111.指数之和的对数(Log-Sum-Exp)
  • 动态规划多阶段报童模型,c++ 实现, java 实现
  • yolov8,yolo11,yolo12 服务器训练到部署全流程 笔记
  • Verilog:I2C控制器
  • 【RAG】Embeding 和 Rerank学习笔记
  • Excel基础(详细篇):总结易忽视的知识点,有用的细节操作
  • 基因枷锁下的太空梦 —— 千钧一发电影观后感
  • (原创)用python语言基于paddleocr构建批量识别实现纸质和电子的增值税专用发票程序
  • 【漫话机器学习系列】112.逻辑回归(Logistic Regression)
  • Linux tar命令
  • 【漫话机器学习系列】114.逻辑 Sigmoid 函数
  • LE AUDIO广播规范之BASE
  • 【数据结构】堆与二叉树
  • 【漫话机器学习系列】113.逻辑回归(Logistic Regression) VS 线性回归(Linear Regression)
  • 使用Python自动生成图文并茂的网页分析报告
  • React生态、Vue生态与跨框架前端解决方案