Merge pull request #24627 from mdaiter/suitesparseCUDATouchups

suitesparse: refining CUDA support
This commit is contained in:
Aristid Breitkreuz 2017-04-08 11:45:17 +02:00 committed by GitHub
commit 290315ff6a

View File

@ -40,9 +40,9 @@ stdenv.mkDerivation {
-e 's|^[[:space:]]*\(CUDART_LIB =\)|CUDART_LIB = $(CUDA_ROOT)/lib64/libcudart.so|' \
-e 's|^[[:space:]]*\(CUBLAS_LIB =\)|CUBLAS_LIB = $(CUDA_ROOT)/lib64/libcublas.so|' \
-e 's|^[[:space:]]*\(CUDA_INC_PATH =\)|CUDA_INC_PATH = $(CUDA_ROOT)/include/|' \
-e 's|^[[:space:]]*\(NV_20 =\)|NV_20 = -arch=sm_20 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV_30 =\)|NV_30 = -arch=sm_30 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV_35 =\)|NV_35 = -arch=sm_35 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV20 =\)|NV20 = -arch=sm_20 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV30 =\)|NV30 = -arch=sm_30 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV35 =\)|NV35 = -arch=sm_35 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NVCC =\) echo|NVCC = $(CUDA_ROOT)/bin/nvcc|' \
-e 's|^[[:space:]]*\(NVCCFLAGS =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|'
'';
@ -64,7 +64,7 @@ stdenv.mkDerivation {
for i in "$out"/lib/lib*.a; do
ar -x $i
done
''${CC} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse.${SHLIB_EXT}" -lopenblas
${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse.${SHLIB_EXT}" -lopenblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
)
for i in umfpack cholmod amd camd colamd spqr; do
ln -s libsuitesparse.${SHLIB_EXT} "$out"/lib/lib$i.${SHLIB_EXT}