Skip to content

Conversation

@pengcheng888
Copy link
Contributor

@pengcheng888 pengcheng888 commented Jul 9, 2025

描述
在infinicub包中编译cub模板函数,得到infinicub.a静态库,安装在~/.infini/package/目录下。
在编译InfiniCore时,可以直接链接 ~/.infini/package/中的infinicub.a静态库。
因此,不必每次都编译cub模板函数,减少了编译时间。

过程

  1. 构建项目配置
    如果prebuild为true, 则编译infinicub包,输入y确认安装。
    如果prebuild为false, 则跟之前的编译过程一样。
    ps:infinicub包只会在第一次执行 xmake f --nv-gpu=true --cuda=$CUDA_HOME --prebuild=true -cv时,进行包的编译,然后安装到系统目录中。
$ xmake f --nv-gpu=true --cuda=$CUDA_HOME --prebuild=true -cv
  ......
  note: install or modify (m) these packages (pass -y to skip confirm)?
    -> infinicub 1.0.0 [optional]
  please input: y (y/n/m)
  y
  ......
  1. 编译并安装项目
$ xmake build && xmake install

修改前:185.13s。
前

修改后: 30.49 s。
后

编译耗时约减少了83%。

修改内容:
修改1: 增加了infinicub的源码,在./src/infinicub/目录下。
修改2: 增加了描述infinicub信息的cub.lua文件,在./xmake/目录下。
修改3: 修改了./xmake/cuda.lua文件,在infiniop-cuda目标中,增加了infinicub包依赖。
修改4: 修改了./xmake.lua文件,增加了prebuild参数。
修改5: 修改了readme文件的注释。

由于修改了random_sample的cuda的代码,需要重新测试该算子:
win和linux都测试通过!
Screenshot from 2025-07-07 15-57-14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants