okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
b2de2641f
main
1@echo off 2rem The Windows CUDA picture reader for an engine package: strata-vision.exe built for the SAME architectures as the package's strata.exe. 3rem 4rem packaging\build_vision_windows.bat cuda12 <stage folder> CUDA 12.9: 60;61;70;75;80;86;89 (+ 89 PTX) the Pascal / Volta package 5rem packaging\build_vision_windows.bat cuda13 <stage folder> CUDA 13.0: 75;86;89;120 (+ 120 PTX) 6rem 7rem Why: the cuda12 and cuda13 packages used to share one strata-vision.exe, built before the Pascal code existed (unchanged since 0.1.44). On a 8rem Tesla P100 / GTX 10 card the engine ran and the reader stopped with "IM2COL failed / device kernel image is invalid" (#3669), and the 9rem app only said "the vision encoder did not start". Now each variant has its own reader and packaging\package_engine.py refuses a package 10rem whose BUILD.json vision_archs do not cover its archs. 11rem 12rem Needs: Visual Studio 2022 Build Tools (run from a "x64 Native Tools" prompt, or let this call vcvars64), CMake + Ninja, the CUDA toolkit of 13rem the variant (CUDA_PATH_V12_9 / CUDA_PATH_V13_0, or CUDA_PATH already pointing at it). llama.cpp's sources are the vendored third_party\strata-llama: 14rem nothing is downloaded. 15rem 16rem Settings (all optional): STRATA_GGML_DIR a llama.cpp checkout to build from instead (an override, kept for two releases) VISION_BUILD_DIR the build folder 17rem VISION_ARCHS override the architecture list (semicolons) BUILD_JOBS the number of compile jobs (default 4: the CUDA compiler uses RAM) 18rem 19rem It copies strata-vision.exe into <stage folder> and writes vision_archs into <stage folder>\BUILD.json. Nothing is uploaded. 20set local EnableDelayedExpansion 21set "VARIANT=%~1" 22set "STAGE=%~2" 23if "%VARIANT%" ==""goto usage 24if "%STAGE%" ==""goto usage 25for %%I in ("% ~dp0 ..")do set "SRC=%%~fI" 26if / i "%VARIANT%" =="cuda12 " ( 27set "ARCHS=60;61;70;75;80;86;89" 28if defined CUDA_PATH_V12_9 set "CUDA_PATH=%CUDA_PATH_V12_9%" 29)else if / i "%VARIANT%" =="cuda13 " ( 30set "ARCHS=75;86;89;120" 31if defined CUDA_PATH_V13_0 set "CUDA_PATH=%CUDA_PATH_V13_0%" 32)else goto usage 33if defined VISION_ARCHS set "ARCHS=%VISION_ARCHS%" 34if not defined CUDA_PATH (echo CUDA_PATH is not set : install the %VARIANT% toolkit &exit / b 1 ) 35if not exist "%CUDA_PATH%\bin\nvcc.exe" (echo no nvcc .exe in %CUDA_PATH% \bin &exit / b 1 ) 36if not defined BUILD_JOBS set "BUILD_JOBS=4" 37set "VLLAMA=" 38if defined STRATA_GGML_DIR ( 39set "LLAMA=%STRATA_GGML_DIR:\=/%" 40if not exist "!LLAMA!/tools/mtmd" (echo llama .cpp with tools /mtmd not found in !LLAMA ! -check STRATA_GGML_DIR &exit / b 1 ) 41 setVLLAMA ="-DLLAMA_DIR=!LLAMA!" 42) 43if not defined VISION_BUILD_DIR set "VISION_BUILD_DIR=%SRC%\build-vision-%VARIANT%-win" 44if not exist "%STAGE%" mkdir "%STAGE% " 45 46where cl >nul 2 >nul || ( 47for %%V in ("%ProgramFiles%\Microsoft Visual Studio\ 2022 \BuildTools" "%ProgramFiles%\Microsoft Visual Studio\ 2022 \Community" "%ProgramFiles (x86 )%\Microsoft Visual Studio \2022 \BuildTools ")do ( 48if exist "%%~V\VC\Auxiliary\Build\vcvars64.bat" if not defined VCVARS set "VCVARS=%%~V\VC\Auxiliary\Build\vcvars64.bat" 49 ) 50if defined VCVARS call "!VCVARS!" >nul 51) 52where cl >nul 2 >nul || (echo cl .exe not found : run this from an x64 Native Tools prompt &exit / b 1 ) 53 54rem every arch real, and PTX for the newest one, the way the engine is built 55set "REAL=" 56for %%A in (%ARCHS :;= %)do ( 57set "LAST=%%A" 58if defined REAL (set "REAL=!REAL!;%%A-real" )else (set "REAL=%%A-real" ) 59) 60cmake -G Ninja -S "%SRC% \tools \vision " -B "%VISION_BUILD_DIR% " -DCMAKE_BUILD_TYPE =Release !VLLAMA ! ^ 61 -DSTRATA_VISION_CUDA =ON -DSTRATA_PORTABLE =ON -DGGML_CUDA_NCCL =OFF ^ 62 "-DCMAKE_CUDA_ARCHITECTURES =!REAL !;!LAST !-virtual " -DCMAKE_C_COMPILER =cl -DCMAKE_CXX_COMPILER =cl ^ 63 "-DCMAKE_CUDA_COMPILER =%CUDA_PATH %/bin /nvcc .exe " "-DCUDAToolkit_ROOT =%CUDA_PATH %" || exit /b 1 64cmake --build "%VISION_BUILD_DIR %" --target strata -vision -j %BUILD_JOBS % || exit /b 1 65copy /y "%VISION_BUILD_DIR %\bin \strata -vision .exe " "%STAGE %\strata -vision .exe " >nul || exit /b 1 66py -3 "%~dp0package_engine .py " --stamp -vision "%STAGE %" --vision -archs "%ARCHS %" || exit /b 1 67echobuilt : %STAGE %\strata -vision .exe (%VARIANT %,archs %ARCHS %) 68exit /b 0 69 70:usage 71echousage :packaging \build_vision_windows .bat cuda12 ^|cuda13 ^<stage folder with strata .exe ^> 72exit /b 2