安装

有关支持的平台/操作系统和硬件,请查看Github上的兼容性部分。

二进制发行版

您可以通过pip安装Triton的最新稳定版本:

pip install triton

为CPython 3.8-3.12和PyPy 3.8-3.9提供了二进制轮包。

以及最新的夜间版本:

pip install -U --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/Triton-Nightly/pypi/simple/ triton-nightly

从源码安装

Python 包

您可以通过运行以下命令从源代码安装Python包:

git clone https://github.com/triton-lang/triton.git;
cd triton/python;
pip install ninja cmake wheel; # build-time dependencies
pip install -e .

请注意,如果您的系统上没有安装llvm,setup.py脚本将下载官方的LLVM静态库并与之链接。

如需使用自定义LLVM进行构建,请查看Github上的Building with a custom LLVM章节。

您可以通过运行单元测试来测试您的安装:

pip install -e '.[tests]'
pytest -vs test/unit/

以及基准测试

cd bench
python -m run --with-plots --result-dir /tmp/triton-bench