You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 3.7 kB

10 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. include_directories(${PROJECT_SOURCE_DIR})
  2. include_directories(${PROJECT_BINARY_DIR})
  3. list (REMOVE_ITEM FLOAT_TYPES "BFLOAT16")
  4. list (REMOVE_ITEM FLOAT_TYPES "HFLOAT16")
  5. set(LAPACK_SOURCES
  6. potrf/potrf_U_single.c
  7. potrf/potrf_L_single.c
  8. lauum/lauum_U_single.c
  9. lauum/lauum_L_single.c
  10. laed3/laed3_single.c
  11. )
  12. # add a 'z' to filename for complex version
  13. set(LAPACK_MANGLED_SOURCES
  14. getf2/getf2_k.c
  15. lauu2/lauu2_U.c
  16. lauu2/lauu2_L.c
  17. potf2/potf2_U.c
  18. potf2/potf2_L.c
  19. )
  20. # sources that need TRANS set
  21. # this has a 'z' version
  22. set(TRANS_SOURCES
  23. getrs/getrs_single.c
  24. )
  25. # sources that need UNIT set
  26. # these do NOT have a z version
  27. set(UNIT_SOURCES
  28. trtri/trtri_U_single.c
  29. trtri/trtri_L_single.c
  30. )
  31. # these have a 'z' version
  32. set(UNIT_SOURCES2
  33. trti2/trti2_U.c
  34. trti2/trti2_L.c
  35. )
  36. if (NOT RELAPACK_REPLACE)
  37. GenerateNamedObjects("${LAPACK_SOURCES}")
  38. GenerateNamedObjects("${LAPACK_MANGLED_SOURCES}" "" "" false "" "" false 3)
  39. else()
  40. GenerateNamedObjects("${LAPACK_MANGLED_SOURCES}" "" "" false "" "" false 3)
  41. endif()
  42. GenerateNamedObjects("laswp/generic/laswp_k_4.c" "" "laswp_plus" false "" "" false 3)
  43. GenerateNamedObjects("laswp/generic/laswp_k_4.c" "MINUS" "laswp_minus" false "" "" false 3)
  44. foreach (float_type ${FLOAT_TYPES})
  45. if (${float_type} STREQUAL "BFLOAT16")
  46. continue()
  47. endif()
  48. GenerateNamedObjects("getrf/getrf_single.c" "UNIT" "getrf_single" false "" "" false ${float_type})
  49. endforeach ()
  50. # dynamic_arch laswp needs arch specific code ?
  51. #foreach(TARGET_CORE ${DYNAMIC_CORE})
  52. # set(TSUFFIX "_${TARGET_CORE}")
  53. #
  54. #GenerateNamedObjects("laswp/generic/laswp_k_4.c" "" "laswp_plus" false "" ${TSUFFIX} false 3)
  55. #GenerateNamedObjects("laswp/generic/laswp_k_4.c" "MINUS" "laswp_minus" false "" ${TSUFFIX} false 3)
  56. #endforeach ()
  57. if (USE_THREAD)
  58. if (USE_OPENMP)
  59. set(GETRF_SRC getrf/getrf_parallel_omp.c)
  60. else ()
  61. set(GETRF_SRC getrf/getrf_parallel.c)
  62. endif ()
  63. # these do not have 'z' versions
  64. set(PARALLEL_SOURCES
  65. lauum/lauum_U_parallel.c
  66. lauum/lauum_L_parallel.c
  67. potrf/potrf_U_parallel.c
  68. potrf/potrf_L_parallel.c
  69. laed3/laed3_parallel.c
  70. )
  71. # this has a z version
  72. list(APPEND TRANS_SOURCES
  73. getrs/getrs_parallel.c
  74. )
  75. # these do NOT have a z version
  76. list(APPEND UNIT_SOURCES
  77. trtri/trtri_U_parallel.c
  78. trtri/trtri_L_parallel.c
  79. )
  80. foreach (float_type ${FLOAT_TYPES})
  81. GenerateNamedObjects("${GETRF_SRC}" "UNIT" "getrf_parallel" false "" "" false ${float_type})
  82. endforeach()
  83. GenerateNamedObjects("${PARALLEL_SOURCES}")
  84. endif ()
  85. foreach (float_type ${FLOAT_TYPES})
  86. if (${float_type} STREQUAL "COMPLEX" OR ${float_type} STREQUAL "ZCOMPLEX")
  87. foreach (trans_src ${TRANS_SOURCES})
  88. string(REGEX MATCH "[a-z]/([a-z]+_)([a-z]+)" op_name ${trans_src})
  89. string(REPLACE "/" "/z" ztrans_src ${trans_src})
  90. GenerateNamedObjects("${ztrans_src}" "TRANS=1" "${CMAKE_MATCH_1}N_${CMAKE_MATCH_2}" false "" "" false ${float_type})
  91. GenerateNamedObjects("${ztrans_src}" "TRANS=2" "${CMAKE_MATCH_1}T_${CMAKE_MATCH_2}" false "" "" false ${float_type})
  92. GenerateNamedObjects("${ztrans_src}" "TRANS=3" "${CMAKE_MATCH_1}R_${CMAKE_MATCH_2}" false "" "" false ${float_type})
  93. GenerateNamedObjects("${ztrans_src}" "TRANS=4" "${CMAKE_MATCH_1}C_${CMAKE_MATCH_2}" false "" "" false ${float_type})
  94. endforeach ()
  95. else ()
  96. GenerateCombinationObjects("${TRANS_SOURCES}" "TRANS" "N" "" 4 "" false ${float_type})
  97. endif ()
  98. endforeach ()
  99. GenerateCombinationObjects("${UNIT_SOURCES}" "UNIT" "N" "" 4)
  100. GenerateCombinationObjects("${UNIT_SOURCES2}" "UNIT" "N" "" 0 "" "" 3)
  101. add_library(lapack OBJECT ${OPENBLAS_SRC})
  102. if (USE_OPENMP)
  103. target_link_libraries(lapack OpenMP::OpenMP_C)
  104. endif()