Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions 02_quant_dequant/黄新颖/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CMake 与本地构建目录
/build/
/cmake-build-*/
/CMakeCache.txt
/CMakeFiles/
/CTestTestfile.cmake
/Testing/
/compile_commands.json
/CMakeUserPresets.json

# 程序运行产生的文件
/outputs/
/logs/
*.log
*.jsonl
*.csv

# Python 实验脚本的解释器缓存
__pycache__/
*.pyc

# 大型或临时二进制数据;小型测试样例可显式保留在 tests/data/。
*.bin
!tests/data/
!tests/data/**/*.bin

# CUDA 分析和编译中间产物
*.ptx
*.cubin
*.fatbin
*.nsys-rep
*.ncu-rep
50 changes: 50 additions & 0 deletions 02_quant_dequant/黄新颖/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.22)

project(quant_dequant LANGUAGES CXX CUDA)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# CMake 3.22 尚未定义 CUDA20 对应的 NVCC 编译选项。host 侧 .cpp 继续
# 使用 C++20;.cu 文件使用 CUDA 12.1 与 CMake 3.22 均明确支持的 C++17。
# 当前 codec 和 kernel 约束在 C++17 可用特性内,以便两种编译路径一致。
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

option(QUANT_DEQUANT_BUILD_TESTS "构建正确性测试" ON)
option(QUANT_DEQUANT_BUILD_APPS "构建命令行程序" ON)
option(QUANT_DEQUANT_BUILD_BENCHMARKS "构建性能评测程序" ON)
set(QUANT_DEQUANT_CUDA_ARCHITECTURES "" CACHE STRING
"目标 CUDA 架构,例如 RTX 4060 使用 89;留空时由 CMake 决定")

if(QUANT_DEQUANT_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "${QUANT_DEQUANT_CUDA_ARCHITECTURES}" CACHE STRING
"CUDA 架构列表" FORCE)
endif()

include(CTest)
find_package(CUDAToolkit REQUIRED)

function(quant_dequant_enable_warnings target_name)
target_compile_options(${target_name}
PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:-Wall -Wextra -Wpedantic>
)
endfunction()

# src 只生成可复用核心库;应用、测试和性能评测各自链接该库。
add_subdirectory(src)

if(QUANT_DEQUANT_BUILD_APPS)
add_subdirectory(apps)
endif()

if(BUILD_TESTING AND QUANT_DEQUANT_BUILD_TESTS)
add_subdirectory(tests)
endif()

if(QUANT_DEQUANT_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
60 changes: 60 additions & 0 deletions 02_quant_dequant/黄新颖/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 0
},
"configurePresets": [
{
"name": "base",
"hidden": true,
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"QUANT_DEQUANT_BUILD_APPS": "ON",
"QUANT_DEQUANT_BUILD_BENCHMARKS": "ON",
"QUANT_DEQUANT_BUILD_TESTS": "ON",
"QUANT_DEQUANT_CUDA_ARCHITECTURES": "89"
}
},
{
"name": "rtx4060-release",
"displayName": "RTX 4060 Release",
"description": "为 NVIDIA RTX 4060(compute capability 8.9)构建 Release 版本。",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "rtx4060-debug",
"displayName": "RTX 4060 Debug",
"description": "为 NVIDIA RTX 4060(compute capability 8.9)构建 Debug 版本。",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
}
],
"buildPresets": [
{
"name": "rtx4060-release",
"configurePreset": "rtx4060-release"
},
{
"name": "rtx4060-debug",
"configurePreset": "rtx4060-debug"
}
],
"testPresets": [
{
"name": "rtx4060-release",
"configurePreset": "rtx4060-release"
},
{
"name": "rtx4060-debug",
"configurePreset": "rtx4060-debug"
}
]
}
Loading