42 lines
2 KiB
Batchfile
42 lines
2 KiB
Batchfile
@echo off
|
|
rem Build igneum-bench-cuda for one program pack (Windows).
|
|
rem Run from an "x64 Native Tools Command Prompt" so cl.exe is on PATH.
|
|
rem Visual Studio 2026 (toolset 14.5x) crashes CUDA 12.8 (cudafe++ 0xC0000005). Install the "MSVC v143" component and run
|
|
rem "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.30
|
|
rem first, then this script. The script passes -allow-unsupported-compiler already.
|
|
rem with CUDA Toolkit 12.8 or newer installed (nvcc on PATH).
|
|
rem Usage: build.bat [pack] [arch]
|
|
rem pack directory name under packs\ (default igneum-genesis)
|
|
rem arch nvcc -arch value (default sm_120 = RTX 50 series / Blackwell; "native" picks the installed GPU)
|
|
setlocal
|
|
cd /d "%~dp0"
|
|
|
|
set PACK=%1
|
|
if "%PACK%"=="" set PACK=igneum-genesis
|
|
set ARCH=%2
|
|
if "%ARCH%"=="" set ARCH=sm_120
|
|
|
|
where cl >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo cl.exe not found. Open an "x64 Native Tools Command Prompt for VS 2022" ^(Visual Studio Build Tools, Desktop development with C++^) and run this again.
|
|
exit /b 1
|
|
)
|
|
where nvcc >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo nvcc not found. Install CUDA Toolkit 12.8 or newer; the installer puts nvcc on PATH.
|
|
exit /b 1
|
|
)
|
|
if not exist "packs\%PACK%\kernel.cu" (
|
|
echo no pack at packs\%PACK% ^(expected kernel.cu, program.h, vectors.h^)
|
|
exit /b 1
|
|
)
|
|
|
|
nvcc --version
|
|
echo nvcc -O3 -std=c++17 -arch=%ARCH% -allow-unsupported-compiler -I "packs\%PACK%" -o "igneum-bench-cuda-%PACK%.exe" host.cu "packs\%PACK%\kernel.cu"
|
|
nvcc -O3 -std=c++17 -arch=%ARCH% -allow-unsupported-compiler -I "packs\%PACK%" -o "igneum-bench-cuda-%PACK%.exe" host.cu "packs\%PACK%\kernel.cu"
|
|
if errorlevel 1 (
|
|
echo build failed. The script already passes -allow-unsupported-compiler for Visual Studio versions newer than CUDA expects. If the errors are inside CUDA headers, install the "MSVC v143 - VS 2022 C++ x64 build tools" component from the Visual Studio Installer and build again, or install a newer CUDA Toolkit.
|
|
exit /b 1
|
|
)
|
|
echo built igneum-bench-cuda-%PACK%.exe
|
|
endlocal
|