#! /bin/bash

ROCM_PATH=${ROCM_PATH:="/opt/rocm"}

function build() {
    rm -rf build
    mkdir build && cd build
    cmake -DCMAKE_INSTALL_PREFIX=${ROCM_PATH} -DAMDGPU_TARGETS="gfx906;gfx926;gfx928" -DBUILD_TESTS=ON ..
    make -j 32
}

main() {

    export CXX=${ROCM_PATH}/bin/hipcc
    export HSA_FORCE_FINE_GRAIN_PCIE=1

    echo -e "============ BUILD START =============\n"
    sleep 5
    
    build
    echo -e "\n\n============ BUILD END =============\n"

}

# 脚本的末尾调用主函数
main "$@"