# FSL-components --- - [fsl-eddy 编译](#fsl-eddy编译) - [fsl-ptx2-cuda 编译](#fsl-ptx2-cuda编译) --- ### fsl-eddy编译 [回到文档开头](#) fsl编译: 快速开始: ```shell git clone http://developer.sourcefind.cn/codes/tsoc/fsl-components.git # 注意点:使用之前确保DTK没有激活 cuda 环境 使用:fsl-components/FSL-install-config/config 覆盖真正的 FSL-install/config cd fsl-eddy bash compile.sh ``` 基于 2401.2 版本,实现hip转码。配合 6.0.7.19 的 FSL 可以在DCU上正常运行 在这里分享下 hip 转码 的经验; 1、基于 DTK-25.04.1 完成转码以及 FSL 工程的适配; ```bash hipconvertinplace-perl.sh fsl-eddy/cuda ``` cuda 文件夹下原有的代码,转码后以 org-name.h/cu.prehip 形式存储在当前目录 由于要使用hip编译, 因此所有的 cu 后缀, 修改为 hip 或者 cpp; 2、对应Makefile, 所有的 cu 后缀, 修改为 hip 或者 cpp; cudabuild/cuda${CUDA_VER}/%.o: cuda/%.cu ==> cudabuild/cuda${CUDA_VER}/%.o: cuda/%.cpp 原有的nvcc 编译器修改为 hipcc 3、代码中编译的问题解决: - CublasHandleManager.h ```cpp #if !defined(ROCM_SYMLINK_HIPBLAS_H) #error hipblas.h must be included at the very top of any file including CublasHandleManager.h #endif 从 CUBLAS_V2_H_ 更改为 ROCM_SYMLINK_HIPBLAS_H ``` - 增加文件: math_constants.h - EddyMatrixKernels.cpp 中不支持 min 的问题解决 ```bash __global__ void QR(// Input const float *K, // Row-first matrices to decompose unsigned int m, // Number of rows of K unsigned int n, // Number of columns of K unsigned int nmat, // Number of matrices // Output float *Qt, // nmat mxm Q matrices float *R) // nmat mxn R matrices { extern __shared__ float scratch[]; if (blockIdx.x < nmat && threadIdx.x < m) { unsigned int id = threadIdx.x; // unsigned int ntpm = min(m,blockDim.x); // Number of threads per matrix unsigned int ntpm = (m < blockDim.x) ? m : blockDim.x; float *v = scratch; float *w = &scratch[m]; const float *lK = &K[blockIdx.x*m*n]; float *lQt = &Qt[blockIdx.x*m*m]; float *lR = &R[blockIdx.x*m*n]; qr_single(lK,m,n,v,w,id,ntpm,lQt,lR); } return; } ``` ### fsl-ptx2-cuda编译 快速开始: ```shell git clone http://developer.sourcefind.cn/codes/tsoc/fsl-components.git 注意点:使用之前确保DTK没有激活 cuda 环境 FSL-install 代表之前的 FSL 安装目录 使用 fsl-components/FSL-install-config/config 覆盖真正的 FSL-install/config 使用 fsl-ptx2-cuda-11.0 替换 FSL-install/src 之中的 fsl-ptx2-cuda-11.0 cd FSL-install/src/fsl-ptx2-cuda-11.0 source /opt/dtk/cuda/env.sh make cpu=1 gpu=1 -j$(nproc) make install 即可得到适配DCU的 FSL-install/bin/probtrackx2_gpu11.8 测试之前, 激活 cuda 环境 source /opt/dtk/cuda/env.sh ```