|
| 1 | +--- magma-2.2.0/CMakeLists.txt 2016-11-20 20:20:02.000000000 -0500 |
| 2 | ++++ magma-2.2.0/CMakeLists.txt 2017-07-17 01:10:32.161739159 -0400 |
| 3 | +@@ -60,6 +60,7 @@ |
| 4 | + message( WARNING "The compiler ${CMAKE_C_COMPILER} doesn't support the -std=c99 flag. Some code may not compile.") |
| 5 | + endif() |
| 6 | + |
| 7 | ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -fno-exceptions") |
| 8 | + |
| 9 | + # ---------------------------------------- |
| 10 | + # check Fortran name mangling |
| 11 | +@@ -79,14 +80,14 @@ |
| 12 | + |
| 13 | + # ---------------------------------------- |
| 14 | + # locate OpenMP |
| 15 | +-find_package( OpenMP ) |
| 16 | +-if ( OPENMP_FOUND ) |
| 17 | +- message( STATUS "Found OpenMP" ) |
| 18 | +- message( STATUS " OpenMP_C_FLAGS ${OpenMP_C_FLAGS}" ) |
| 19 | +- message( STATUS " OpenMP_CXX_FLAGS ${OpenMP_CXX_FLAGS}" ) |
| 20 | +- set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" ) |
| 21 | +- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" ) |
| 22 | +-endif() |
| 23 | ++# find_package( OpenMP ) |
| 24 | ++# if ( OPENMP_FOUND ) |
| 25 | ++# message( STATUS "Found OpenMP" ) |
| 26 | ++# message( STATUS " OpenMP_C_FLAGS ${OpenMP_C_FLAGS}" ) |
| 27 | ++# message( STATUS " OpenMP_CXX_FLAGS ${OpenMP_CXX_FLAGS}" ) |
| 28 | ++# set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" ) |
| 29 | ++# set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" ) |
| 30 | ++# endif() |
| 31 | + |
| 32 | + |
| 33 | + # ---------------------------------------- |
| 34 | +@@ -164,13 +165,20 @@ |
| 35 | + set( NV_SM "${NV_SM} -gencode arch=compute_50,code=sm_50" ) |
| 36 | + set( NV_COMP "-gencode arch=compute_50,code=compute_50" ) |
| 37 | + message( STATUS " compile for CUDA arch 5.0 (Maxwell)" ) |
| 38 | +- endif() |
| 39 | ++ endif() |
| 40 | ++ |
| 41 | ++ if ( ${GPU_TARGET} MATCHES "All") |
| 42 | ++ set( MIN_ARCH 200) |
| 43 | ++ SET( NV_SM "-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_32,code=sm_32 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 ") |
| 44 | ++ SET( NV_COMP "") |
| 45 | ++ endif() |
| 46 | + |
| 47 | + if ( NOT MIN_ARCH ) |
| 48 | + message( FATAL_ERROR "GPU_TARGET must contain one or more of Fermi, Kepler, Maxwell, or sm{20,30,35,50}." ) |
| 49 | + endif() |
| 50 | + |
| 51 | +- set( CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -DHAVE_CUBLAS ${NV_SM} ${NV_COMP} ${FORTRAN_CONVENTION}" ) |
| 52 | ++ set( CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -DHAVE_CUBLAS -Xcompiler -fPIC ${NV_SM} ${NV_COMP} ${FORTRAN_CONVENTION}" ) |
| 53 | ++ MESSAGE(STATUS "CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}") |
| 54 | + add_definitions( "-DHAVE_CUBLAS -DMIN_CUDA_ARCH=${MIN_ARCH}" ) |
| 55 | + message( STATUS "Define -DHAVE_CUBLAS -DMIN_CUDA_ARCH=${MIN_ARCH}" ) |
| 56 | + endif() |
| 57 | +@@ -181,7 +189,7 @@ |
| 58 | + set( LAPACK_LIBRARIES "" CACHE STRING "Libraries for LAPACK and BLAS, to manually override search" ) |
| 59 | + if ( "${LAPACK_LIBRARIES}" STREQUAL "" ) |
| 60 | + message( STATUS "Searching for BLAS and LAPACK. To override, set LAPACK_LIBRARIES using ccmake." ) |
| 61 | +- find_package( LAPACK ) |
| 62 | ++ # find_package( LAPACK ) |
| 63 | + else() |
| 64 | + message( STATUS "User set LAPACK_LIBRARIES. To change, edit LAPACK_LIBRARIES using ccmake (set to empty to enable search)." ) |
| 65 | + # Check existence -- but this may be okay, if the user entered, e.g., -llapack instead of /path/to/lapack.a |
| 66 | +@@ -228,7 +236,8 @@ |
| 67 | + # ---------------------------------------- |
| 68 | + # common flags |
| 69 | + |
| 70 | +-set( LIBS tester lapacktest magma ) |
| 71 | ++# set( LIBS tester lapacktest magma ) |
| 72 | ++set( LIBS magma) |
| 73 | + |
| 74 | + if ( WIN32 ) |
| 75 | + # On Windows: |
| 76 | +@@ -336,32 +345,33 @@ |
| 77 | + ) |
| 78 | + endif() |
| 79 | + |
| 80 | ++set_target_properties(magma PROPERTIES POSITION_INDEPENDENT_CODE ON) |
| 81 | + |
| 82 | + # ---------------------------------------- |
| 83 | + # compile tester library |
| 84 | +-add_library( tester ${libtest_all} ) |
| 85 | ++# add_library( tester ${libtest_all} ) |
| 86 | + |
| 87 | + |
| 88 | + # ---------------------------------------- |
| 89 | + # compile lapacktest library |
| 90 | + # If use fortran, compile only Fortran files, not magma_[sdcz]_no_fortran.cpp |
| 91 | + # else, compile only C++ files, not Fortran files |
| 92 | +-if ( USE_FORTRAN ) |
| 93 | +- foreach( f ${liblapacktest_all} ) |
| 94 | +- if ( ${f} MATCHES "\\.(f|f90)$" ) |
| 95 | +- list( APPEND liblapacktest_all_f ${f} ) |
| 96 | +- endif() |
| 97 | +- endforeach() |
| 98 | +- add_library( lapacktest ${liblapacktest_all_f} ) |
| 99 | +-else() |
| 100 | +- # alternatively, use only C/C++/CUDA files, including magma_[sdcz]_no_fortran.cpp |
| 101 | +- foreach( f ${liblapacktest_all} ) |
| 102 | +- if ( ${f} MATCHES "\\.(c|cu|cpp)$" ) |
| 103 | +- list( APPEND liblapacktest_all_cpp ${f} ) |
| 104 | +- endif() |
| 105 | +- endforeach() |
| 106 | +- add_library( lapacktest ${liblapacktest_all_cpp} ) |
| 107 | +-endif() |
| 108 | ++# if ( USE_FORTRAN ) |
| 109 | ++# foreach( f ${liblapacktest_all} ) |
| 110 | ++# if ( ${f} MATCHES "\\.(f|f90)$" ) |
| 111 | ++# list( APPEND liblapacktest_all_f ${f} ) |
| 112 | ++# endif() |
| 113 | ++# endforeach() |
| 114 | ++# add_library( lapacktest ${liblapacktest_all_f} ) |
| 115 | ++# else() |
| 116 | ++# # alternatively, use only C/C++/CUDA files, including magma_[sdcz]_no_fortran.cpp |
| 117 | ++# foreach( f ${liblapacktest_all} ) |
| 118 | ++# if ( ${f} MATCHES "\\.(c|cu|cpp)$" ) |
| 119 | ++# list( APPEND liblapacktest_all_cpp ${f} ) |
| 120 | ++# endif() |
| 121 | ++# endforeach() |
| 122 | ++# add_library( lapacktest ${liblapacktest_all_cpp} ) |
| 123 | ++# endif() |
| 124 | + |
| 125 | + |
| 126 | + # ---------------------------------------- |
| 127 | +@@ -380,42 +390,42 @@ |
| 128 | + ${CUDA_cusparse_LIBRARY} |
| 129 | + ) |
| 130 | + set( LIBS_SPARSE ${LIBS} magma_sparse ) |
| 131 | +- |
| 132 | ++set_target_properties(magma_sparse PROPERTIES POSITION_INDEPENDENT_CODE ON) |
| 133 | + |
| 134 | + # ---------------------------------------- |
| 135 | + # compile each tester |
| 136 | + |
| 137 | + # save testers to testing/ |
| 138 | + # save tester lib files to testing_lib/ to avoid cluttering lib/ |
| 139 | +-set( CMAKE_RUNTIME_OUTPUT_DIRECTORY testing ) |
| 140 | +-set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY testing_lib ) |
| 141 | +-set( CMAKE_LIBRARY_OUTPUT_DIRECTORY testing_lib ) |
| 142 | ++# set( CMAKE_RUNTIME_OUTPUT_DIRECTORY testing ) |
| 143 | ++# set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY testing_lib ) |
| 144 | ++# set( CMAKE_LIBRARY_OUTPUT_DIRECTORY testing_lib ) |
| 145 | + |
| 146 | + # skip Fortran testers, which require an extra file from CUDA |
| 147 | +-foreach( f ${testing_all} ) |
| 148 | +- if ( ${f} MATCHES "\\.(c|cu|cpp)$" ) |
| 149 | +- list( APPEND testing_all_cpp ${f} ) |
| 150 | +- endif() |
| 151 | +-endforeach() |
| 152 | +-foreach( TEST ${testing_all_cpp} ) |
| 153 | +- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) |
| 154 | +- string( REGEX REPLACE "testing/" "" EXE ${EXE} ) |
| 155 | +- #message( "${TEST} --> ${EXE}" ) |
| 156 | +- add_executable( ${EXE} ${TEST} ) |
| 157 | +- target_link_libraries( ${EXE} ${LIBS} ) |
| 158 | +-endforeach() |
| 159 | ++# foreach( f ${testing_all} ) |
| 160 | ++# if ( ${f} MATCHES "\\.(c|cu|cpp)$" ) |
| 161 | ++# list( APPEND testing_all_cpp ${f} ) |
| 162 | ++# endif() |
| 163 | ++# endforeach() |
| 164 | ++# foreach( TEST ${testing_all_cpp} ) |
| 165 | ++# string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) |
| 166 | ++# string( REGEX REPLACE "testing/" "" EXE ${EXE} ) |
| 167 | ++# #message( "${TEST} --> ${EXE}" ) |
| 168 | ++# add_executable( ${EXE} ${TEST} ) |
| 169 | ++# target_link_libraries( ${EXE} ${LIBS} ) |
| 170 | ++# endforeach() |
| 171 | + |
| 172 | + |
| 173 | + # ---------------------------------------- |
| 174 | + # compile each sparse tester |
| 175 | +-set( CMAKE_RUNTIME_OUTPUT_DIRECTORY sparse/testing ) |
| 176 | +-foreach( TEST ${sparse_testing_all} ) |
| 177 | +- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) |
| 178 | +- string( REGEX REPLACE "sparse/testing/" "" EXE ${EXE} ) |
| 179 | +- #message( "${TEST} --> ${EXE}" ) |
| 180 | +- add_executable( ${EXE} ${TEST} ) |
| 181 | +- target_link_libraries( ${EXE} ${LIBS_SPARSE} ) |
| 182 | +-endforeach() |
| 183 | ++# set( CMAKE_RUNTIME_OUTPUT_DIRECTORY sparse/testing ) |
| 184 | ++# foreach( TEST ${sparse_testing_all} ) |
| 185 | ++# string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) |
| 186 | ++# string( REGEX REPLACE "sparse/testing/" "" EXE ${EXE} ) |
| 187 | ++# #message( "${TEST} --> ${EXE}" ) |
| 188 | ++# add_executable( ${EXE} ${TEST} ) |
| 189 | ++# target_link_libraries( ${EXE} ${LIBS_SPARSE} ) |
| 190 | ++# endforeach() |
| 191 | + |
| 192 | + |
| 193 | + # ---------------------------------------- |
0 commit comments