快速开始

page autotoc_md0

  1. Linux系统

目前ChipSum仅支持Linux系统

  1. CMake

    ChipSum以及第三方库kokkoskokkos-kernels的编译, 都需要Cmake>3.16,推荐使用3.20.0

  2. 获取ChipSum代码

# get ChipSum
git clone https://gitee.com/chip-sum/ChipSum.git

# get kokkos and kokkos-kernels
cd ChipSum/

git submodule init
git submodule update
若您使用成都或昆山超算上使用DCU进行编译和运行,需要将KOKKOS版本切换至3.3.01
cd tpls/kokkos
git checkout 

为了方便用户编译,ChipSum使用了一个python脚本帮助完成编译过程。已分别在AMD VEGA906NVIDIA 2080ti等架构上完成编译并运行。

1 AMD VEGA906

# AMD Vega906/900  
python3 setup.py arch=VEGA906 compiler=/path/to/your/rocm(i.e. 4.0.1)/bin/hipcc hip=/path/to/your/rocm(i.e. 4.0.1)/hip

2 NVIDIA 2080ti

# NVIDIA 2080ti
python3 setup.py arch=Turing75 cuda=/Path/To/Your/Cuda

3 Volta72

# for Volta72
python3 setup.py cuda=/Path/To/Your/Cuda arch=Volta72

4 MX350(Pascal61)

# for MX350(Pascal61)
python3 setup.py cuda=/Path/To/Your/Cuda arch=Pascal61

5 CPU编译 根据设备CPU架构输入arch参数,多数情况下为WSM

python3 setup.py arch=WSM compiler=g++ j=20

6 其他

若想指定安装目录,可以使用prefix参数

mkdir /anywhere/you/like
python3 setup.py prefix=/anywhere/you/like
若想指定核编译,可以使用j参数
python3 setup.py j=32
注意:第一次编译时需编译kokkos和kokkos-kernels,耗时较久。后续使用时仅编译ChipSum内容,耗时很快。

ChipSumtest.cpp中提供了一个简单的用例示范,默认路径编译完成后,可以在./build中查看编译结果。

# default path
cd ./build
./ChipSum

预期输出:

vector_0: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
3.3
scalar_1: [0, 3.3, 6.6, 9.9, 13.2, 16.5, 19.8, 23.1, 26.4, 29.7]

xml/CG.png 按默认路径完成编译后,在./build/examples/chipsumSolver路径下存在cg算法的可执行文件,同时利用./data路径中的矩阵文件,可以实现一个简单的求解算例:

cd path_to_chipsum
./build/examples/chipsumSolver/cg data/A.mtx data/b.csv

xml/BiCG.png 按默认路径完成编译后,在./build/examples/chipsumSolver路径下存在BiCG算法的可执行文件,同时利用./data路径中的矩阵文件,可以实现一个简单的求解算例:

cd path_to_chipsum
./build/examples/chipsumSolver/bicg data/A.mtx data/b.csv

xml/BiCGSTAB.png 按默认路径完成编译后,在./build/examples/chipsumSolver路径下存在BiCGSTAB算法的可执行文件,同时利用./data路径中的矩阵文件,可以实现一个简单的求解算例:

cd path_to_chipsum
./build/examples/chipsumSolver/bicgstab data/A.mtx data/b.csv

xml/GMRES.png

按默认路径完成编译后,在./build/examples/chipsumSolver路径下存在GMRES算法的可执行文件,同时利用./data路径中的矩阵文件,可以实现一个简单的求解算例:

cd path_to_chipsum
./build/examples/chipsumSolver/gmres data/A.mtx data/b.csv

四、应用

我们实现了一个基于ChipSum的应用,chipsumAI。该应用利用ChipSum的函数方法和数据结构等,完成了一个mnist手写体识别样例。该部分将介绍如何编译和运行chipsumAI