Skip to content

Instantly share code, notes, and snippets.

@oxyflour
Created October 1, 2019 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oxyflour/b98a26f51a0e4b20066401a63954360e to your computer and use it in GitHub Desktop.
Save oxyflour/b98a26f51a0e4b20066401a63954360e to your computer and use it in GitHub Desktop.
use prebuilt magma binary on windows (from PyTorch)
rem update blas dir and cuda version
set BLAS_DIR=D:\Programs\OpenBLAS-0.3.7-x64
set CUDA_PREFIX=cuda100
set OUTPUT_EXE=build\main
set MAGMA_DIR=%~dp0\build\magma
if not exist %MAGMA_DIR% (
rem using static library precompiled for pytorch
rem https://github.com/pytorch/pytorch/blob/master/docs/source/notes/windows.rst
rem Make sure you have 7z and curl installed.
curl -k https://s3.amazonaws.com/ossci-windows/magma_2.5.0_%CUDA_PREFIX%_release.7z -o build/magma.7z
7z x -aoa build/magma.7z -obuild/magma
)
nvcc main.c -o %OUTPUT_EXE% ^
-I%MAGMA_DIR%\include ^
-L%BLAS_DIR%\lib -L%MAGMA_DIR%\lib ^
-lcusparse -lcublas -lmagma -lmagma_sparse -llibopenblas ^
-Xcompiler /MD
%OUTPUT_EXE%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment