Skip to content

Instantly share code, notes, and snippets.

@atinfinity
Created March 20, 2017 12:10
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 atinfinity/dac779777ca872a9e2abdf1b1009a9a6 to your computer and use it in GitHub Desktop.
Save atinfinity/dac779777ca872a9e2abdf1b1009a9a6 to your computer and use it in GitHub Desktop.
patch file to support Pascal(MAGMA 2.2.0)
--- org/magma-2.2.0/CMakeLists.txt 2016-11-21 10:20:02.000000000 +0900
+++ changed/magma-2.2.0/CMakeLists.txt 2017-03-20 01:25:52.329109000 +0900
@@ -129,6 +129,10 @@
if ( ${GPU_TARGET} MATCHES Maxwell )
set( GPU_TARGET "${GPU_TARGET} sm50" )
endif()
+
+ if ( ${GPU_TARGET} MATCHES Pascal )
+ set( GPU_TARGET "${GPU_TARGET} sm61" )
+ endif()
if ( ${GPU_TARGET} MATCHES sm20 )
if ( NOT MIN_ARCH )
@@ -165,6 +169,15 @@
set( NV_COMP "-gencode arch=compute_50,code=compute_50" )
message( STATUS " compile for CUDA arch 5.0 (Maxwell)" )
endif()
+
+ if ( ${GPU_TARGET} MATCHES sm61 )
+ if ( NOT MIN_ARCH )
+ set( MIN_ARCH 600 )
+ endif()
+ set( NV_SM "${NV_SM} -gencode arch=compute_61,code=sm_61" )
+ set( NV_COMP "-gencode arch=compute_61,code=compute_61" )
+ message( STATUS " compile for CUDA arch 6.1 (Pascal)" )
+ endif()
if ( NOT MIN_ARCH )
message( FATAL_ERROR "GPU_TARGET must contain one or more of Fermi, Kepler, Maxwell, or sm{20,30,35,50}." )
@@ -228,7 +241,8 @@
# ----------------------------------------
# common flags
-set( LIBS tester lapacktest magma )
+#set( LIBS tester lapacktest magma )
+set( LIBS magma )
if ( WIN32 )
# On Windows:
@@ -327,7 +341,7 @@
set( LIBS tester lapacktest magma ) ##magmaf )
else()
# Unix doesn't seem to have a problem with mixing C, CUDA, and Fortran files
- cuda_add_library( magma ${libmagma_all} )
+ cuda_add_library( magma SHARED ${libmagma_all} )
target_link_libraries( magma
${LAPACK_LIBRARIES}
${CUDA_CUDART_LIBRARY}
@@ -339,29 +353,29 @@
# ----------------------------------------
# compile tester library
-add_library( tester ${libtest_all} )
+#add_library( tester ${libtest_all} )
# ----------------------------------------
# compile lapacktest library
# If use fortran, compile only Fortran files, not magma_[sdcz]_no_fortran.cpp
# else, compile only C++ files, not Fortran files
-if ( USE_FORTRAN )
- foreach( f ${liblapacktest_all} )
- if ( ${f} MATCHES "\\.(f|f90)$" )
- list( APPEND liblapacktest_all_f ${f} )
- endif()
- endforeach()
- add_library( lapacktest ${liblapacktest_all_f} )
-else()
- # alternatively, use only C/C++/CUDA files, including magma_[sdcz]_no_fortran.cpp
- foreach( f ${liblapacktest_all} )
- if ( ${f} MATCHES "\\.(c|cu|cpp)$" )
- list( APPEND liblapacktest_all_cpp ${f} )
- endif()
- endforeach()
- add_library( lapacktest ${liblapacktest_all_cpp} )
-endif()
+#if ( USE_FORTRAN )
+# foreach( f ${liblapacktest_all} )
+# if ( ${f} MATCHES "\\.(f|f90)$" )
+# list( APPEND liblapacktest_all_f ${f} )
+# endif()
+# endforeach()
+# add_library( lapacktest ${liblapacktest_all_f} )
+#else()
+# # alternatively, use only C/C++/CUDA files, including magma_[sdcz]_no_fortran.cpp
+# foreach( f ${liblapacktest_all} )
+# if ( ${f} MATCHES "\\.(c|cu|cpp)$" )
+# list( APPEND liblapacktest_all_cpp ${f} )
+# endif()
+# endforeach()
+# add_library( lapacktest ${liblapacktest_all_cpp} )
+#endif()
# ----------------------------------------
@@ -370,8 +384,8 @@
# sparse doesn't have Fortran at the moment, so no need for above shenanigans
include_directories( sparse/include )
include_directories( sparse/control )
-include_directories( testing )
-cuda_add_library( magma_sparse ${libsparse_all} )
+#include_directories( testing )
+cuda_add_library( magma_sparse SHARED ${libsparse_all} )
target_link_libraries( magma_sparse
magma
${LAPACK_LIBRARIES}
@@ -387,35 +401,35 @@
# save testers to testing/
# save tester lib files to testing_lib/ to avoid cluttering lib/
-set( CMAKE_RUNTIME_OUTPUT_DIRECTORY testing )
-set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY testing_lib )
-set( CMAKE_LIBRARY_OUTPUT_DIRECTORY testing_lib )
+#set( CMAKE_RUNTIME_OUTPUT_DIRECTORY testing )
+#set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY testing_lib )
+#set( CMAKE_LIBRARY_OUTPUT_DIRECTORY testing_lib )
# skip Fortran testers, which require an extra file from CUDA
-foreach( f ${testing_all} )
- if ( ${f} MATCHES "\\.(c|cu|cpp)$" )
- list( APPEND testing_all_cpp ${f} )
- endif()
-endforeach()
-foreach( TEST ${testing_all_cpp} )
- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} )
- string( REGEX REPLACE "testing/" "" EXE ${EXE} )
- #message( "${TEST} --> ${EXE}" )
- add_executable( ${EXE} ${TEST} )
- target_link_libraries( ${EXE} ${LIBS} )
-endforeach()
+#foreach( f ${testing_all} )
+# if ( ${f} MATCHES "\\.(c|cu|cpp)$" )
+# list( APPEND testing_all_cpp ${f} )
+# endif()
+#endforeach()
+#foreach( TEST ${testing_all_cpp} )
+# string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} )
+# string( REGEX REPLACE "testing/" "" EXE ${EXE} )
+# #message( "${TEST} --> ${EXE}" )
+# add_executable( ${EXE} ${TEST} )
+# target_link_libraries( ${EXE} ${LIBS} )
+#endforeach()
# ----------------------------------------
# compile each sparse tester
-set( CMAKE_RUNTIME_OUTPUT_DIRECTORY sparse/testing )
-foreach( TEST ${sparse_testing_all} )
- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} )
- string( REGEX REPLACE "sparse/testing/" "" EXE ${EXE} )
- #message( "${TEST} --> ${EXE}" )
- add_executable( ${EXE} ${TEST} )
- target_link_libraries( ${EXE} ${LIBS_SPARSE} )
-endforeach()
+#set( CMAKE_RUNTIME_OUTPUT_DIRECTORY sparse/testing )
+#foreach( TEST ${sparse_testing_all} )
+# string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} )
+# string( REGEX REPLACE "sparse/testing/" "" EXE ${EXE} )
+# #message( "${TEST} --> ${EXE}" )
+# add_executable( ${EXE} ${TEST} )
+# target_link_libraries( ${EXE} ${LIBS_SPARSE} )
+#endforeach()
# ----------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment