]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: src/erasure-code CMakeLists.txt's changes
authorAli Maredia <amaredia@redhat.com>
Fri, 1 Jan 2016 02:54:21 +0000 (21:54 -0500)
committerAli Maredia <amaredia@redhat.com>
Tue, 5 Jan 2016 20:42:06 +0000 (15:42 -0500)
Added ec_neon libraries in jerasure and shec dirs,
reorganized checks for flags, other minor
erasure-code directory changes.

Signed-off-by: Ali Maredia <amaredia@redhat.com>
src/erasure-code/CMakeLists.txt
src/erasure-code/jerasure/CMakeLists.txt
src/erasure-code/shec/CMakeLists.txt

index b65ffd20ed75f4cb733978093487ec2780271ad8..3bc8f193c388de1c6774f5c51a5774c9067dee05 100644 (file)
@@ -2,12 +2,74 @@
 
 set(erasure_codelibdir ${LIBRARY_OUTPUT_PATH}/erasure-code)
 
+## detect sse support
+
+# create a tmp file with an empty main()
+set(sse_srcs "${CMAKE_BINARY_DIR}/src/erasure-code/jerasure/tmp_sse.c")
+file(WRITE ${sse_srcs} "void main() {}")
+
+# try each -msse flag
+try_compile(INTEL_SSE ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-msse")
+try_compile(INTEL_SSE2 ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-msse2")
+try_compile(INTEL_SSE3 ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-msse3")
+try_compile(INTEL_SSSE3 ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-mssse3")
+try_compile(INTEL_SSE4_1 ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-msse4.1")
+try_compile(INTEL_SSE4_2 ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-msse4.2")
+try_compile(ARM_NEON ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-mfpu=neon")
+try_compile(ARM_NEON2 ${CMAKE_BINARY_DIR} ${sse_srcs}
+  COMPILE_DEFINITIONS "-march=armv8-a+simd")
+
+# clean up tmp file
+file(REMOVE ${sse_srcs})
+
+if(ARM_NEON OR ARM_NEON2)
+  if(ARM_NEON)
+    set(ARM_NEON_FLAGS "-mfpu=neon")
+  else(ARM_NEON)
+    set(ARM_NEON_FLAGS "-march=armv8-a+simd")
+  endif(ARM_NEON)
+else(ARM_NEON OR ARM_NEON2)
+  message(STATUS "Skipping target ec_jerasure_neon & ec_shec_neon: Architecture not ARM")
+endif(ARM_NEON OR ARM_NEON2)
+
+if(INTEL_SSE)
+  set(SSE3_FLAGS "-msse")
+  if (INTEL_SSE2)
+    set(SSE3_FLAGS "${SSE3_FLAGS} -msse2")
+  endif (INTEL_SSE2)
+  if (INTEL_SSE3)
+    set(SSE3_FLAGS "${SSE3_FLAGS} -msse3")
+  endif (INTEL_SSE3)
+  if (INTEL_SSSE3)
+    set(SSE3_FLAGS "${SSE3_FLAGS} -mssse3")
+  endif (INTEL_SSSE3)
+else(INTEL_SSE)
+  message(STATUS "Skipping target ec_jerasure_sse3 & ec_shec_sse3: -msse not supported")
+endif(INTEL_SSE)
+
+if(INTEL_SSE4_1)
+  set(SSE4_FLAGS "${SSE3_FLAGS} -msse4.1")
+  if (INTEL_SSE4_2)
+    set(SSE4_FLAGS "${SSE4_FLAGS} -msse4.2")
+  endif (INTEL_SSE4_2)
+else(INTEL_SSE4_1)
+  message(STATUS "Skipping target ec_jerasure_sse4 & ec_shec_sse4: -msse4.1 not supported")
+endif(INTEL_SSE4_1)
+
 add_subdirectory(jerasure)
 add_subdirectory(lrc)
 add_subdirectory(shec)
 
 if (HAVE_BETTER_YASM_ELF64)
   add_subdirectory(isa)
+  set(EC_ISA_LIB ec_isa)
 endif (HAVE_BETTER_YASM_ELF64)
 
 add_library(erasure_code ErasureCodePlugin.cc)
@@ -17,8 +79,9 @@ add_dependencies(erasure_code ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
 add_library(erasure_code_objs OBJECT ErasureCode.cc)
 
 add_custom_target(erasure_code_plugins DEPENDS
-    ec_isa
+    ${EC_ISA_LIB}
     ec_lrc
     ec_jerasure_sse3
     ec_jerasure_sse4
     ec_jerasure)
+
index f53c6c1db7d1ab400952f1f21d4c988196cc4c1a..c2fb1ef1de750d1b7b02e2a6773edfa9cf305ddc 100644 (file)
@@ -3,30 +3,6 @@
 include_directories(gf-complete/include)
 include_directories(jerasure/include)
 
-## detect sse support
-
-# create a tmp file with an empty main()
-set(sse_srcs "${CMAKE_BINARY_DIR}/src/erasure-code/jerasure/tmp_sse.c")
-file(WRITE ${sse_srcs} "void main() {}")
-
-# try each -msse flag
-try_compile(INTEL_SSE ${CMAKE_BINARY_DIR} ${sse_srcs}
-  COMPILE_DEFINITIONS "-msse")
-try_compile(INTEL_SSE2 ${CMAKE_BINARY_DIR} ${sse_srcs}
-  COMPILE_DEFINITIONS "-msse2")
-try_compile(INTEL_SSE3 ${CMAKE_BINARY_DIR} ${sse_srcs}
-  COMPILE_DEFINITIONS "-msse3")
-try_compile(INTEL_SSSE3 ${CMAKE_BINARY_DIR} ${sse_srcs}
-  COMPILE_DEFINITIONS "-mssse3")
-try_compile(INTEL_SSE4_1 ${CMAKE_BINARY_DIR} ${sse_srcs}
-  COMPILE_DEFINITIONS "-msse4.1")
-try_compile(INTEL_SSE4_2 ${CMAKE_BINARY_DIR} ${sse_srcs}
-  COMPILE_DEFINITIONS "-msse4.2")
-
-# clean up tmp file
-file(REMOVE ${sse_srcs})
-
-
 set(jerasure_srcs
   jerasure/src/cauchy.c
   jerasure/src/galois.c
@@ -55,42 +31,43 @@ target_link_libraries(ec_jerasure_generic ${EXTRALIBS})
 set_target_properties(ec_jerasure_generic PROPERTIES VERSION 2.0.0 SOVERSION 2)
 install(TARGETS ec_jerasure_generic DESTINATION lib/erasure-code)
 
+set(jerasure_neon_srcs
+  ${jerasure_srcs}
+  erasure-code/jerasure/gf-complete/src/neon/gf_w4_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w8_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w16_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w32_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w64_neon.c)
+
+
+#TODO:build libec_jerasure_neon library on an ARM machine
+if(ARM_NEON OR ARM_NEON2)
+  add_library(ec_jerasure_neon SHARED ${jerasure_neon_srcs})
+  add_dependencies(ec_jerasure_neon ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
+  target_link_libraries(ec_jerasure_neon crush pthread ${EXTRALIBS})
+  set_target_properties(ec_jerasure_neon PROPERTIES VERSION 2.0.0 SOVERSION 2
+    COMPILE_FLAGS ${ARM_NEON_FLAGS})
+  install(TARGETS ec_jerasure_neon DESTINATION lib/erasure-code)
+endif(ARM_NEON OR ARM_NEON2)
+
 # ec_jerasure_sse3
 if(INTEL_SSE)
-  set(JERASURE_SSE3_FLAGS "-msse")
-  if (INTEL_SSE2)
-    set(JERASURE_SSE3_FLAGS "${JERASURE_SSE3_FLAGS} -msse2")
-  endif (INTEL_SSE2)
-  if (INTEL_SSE3)
-    set(JERASURE_SSE3_FLAGS "${JERASURE_SSE3_FLAGS} -msse3")
-  endif (INTEL_SSE3)
-  if (INTEL_SSSE3)
-    set(JERASURE_SSE3_FLAGS "${JERASURE_SSE3_FLAGS} -mssse3")
-  endif (INTEL_SSSE3)
   add_library(ec_jerasure_sse3 SHARED ${jerasure_srcs})
   add_dependencies(ec_jerasure_sse3 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
   target_link_libraries(ec_jerasure_sse3 ${EXTRALIBS})
   set_target_properties(ec_jerasure_sse3 PROPERTIES VERSION 2.0.0 SOVERSION 2
-    COMPILE_FLAGS ${JERASURE_SSE3_FLAGS})
+    COMPILE_FLAGS ${SSE3_FLAGS})
   install(TARGETS ec_jerasure_sse3 DESTINATION lib/erasure-code)
-else(INTEL_SSE)
-  message(STATUS "Skipping target ec_jerasure_sse3: -msse not supported")
 endif(INTEL_SSE)
 
 # ec_jerasure_sse4
 if(INTEL_SSE4_1)
-  set(JERASURE_SSE4_FLAGS "${JERASURE_SSE3_FLAGS} -msse4.1")
-  if (INTEL_SSE4_2)
-    set(JERASURE_SSE4_FLAGS "${JERASURE_SSE4_FLAGS} -msse4.2")
-  endif (INTEL_SSE4_2)
   add_library(ec_jerasure_sse4 SHARED ${jerasure_srcs})
   add_dependencies(ec_jerasure_sse4 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
   target_link_libraries(ec_jerasure_sse4 ${EXTRALIBS})
   set_target_properties(ec_jerasure_sse4 PROPERTIES VERSION 2.0.0 SOVERSION 2
-    COMPILE_FLAGS ${JERASURE_SSE4_FLAGS})
+    COMPILE_FLAGS ${SSE4_FLAGS})
   install(TARGETS ec_jerasure_sse4 DESTINATION lib/erasure-code)
-else(INTEL_SSE4_1)
-  message(STATUS "Skipping target ec_jerasure_sse4: -msse4.1 not supported")
 endif(INTEL_SSE4_1)
 
 add_library(ec_jerasure SHARED ErasureCodePluginSelectJerasure.cc)
index 260f4d21838bb1246fcfbbbb063a9a17210d99d4..efe156a146c99b406a1635c9645c77e817a5b619 100644 (file)
@@ -33,4 +33,47 @@ add_dependencies(ec_shec_generic ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
 set_target_properties(ec_shec_generic PROPERTIES VERSION 1.0.0 SOVERSION 1)
 install(TARGETS ec_shec_generic DESTINATION lib/erasure-code)
 
-#TODO:build libec_shec_neon, libec_shec+sse3, libec_shec_sse4 libraries
+# ec_shec_sse3
+set(shec_neon_srcs
+  ${shec_srcs}
+  erasure-code/jerasure/gf-complete/src/neon/gf_w4_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w8_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w16_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w32_neon.c 
+  erasure-code/jerasure/gf-complete/src/neon/gf_w64_neon.c)
+
+#TODO:build libec_shec_neon library on an ARM machine
+if(ARM_NEON OR ARM_NEON2)
+  add_library(ec_shec_neon SHARED ${shec_neon_srcs})
+  add_dependencies(ec_shec_neon ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
+  target_link_libraries(ec_shec_neon ${EXTRALIBS})
+  set_target_properties(ec_shec_neon PROPERTIES VERSION 2.0.0 SOVERSION 2
+    COMPILE_FLAGS ${ARM_NEON_FLAGS})
+  install(TARGETS ec_shec_neon DESTINATION lib/erasure-code)
+endif(ARM_NEON OR ARM_NEON2)
+
+# ec_shec_sse3
+if(INTEL_SSE)
+  add_library(ec_shec_sse3 SHARED ${shec_srcs})
+  add_dependencies(ec_shec_sse3 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
+  target_link_libraries(ec_shec_sse3 ${EXTRALIBS})
+  set_target_properties(ec_shec_sse3 PROPERTIES VERSION 2.0.0 SOVERSION 2
+    COMPILE_FLAGS ${SSE3_FLAGS})
+  install(TARGETS ec_shec_sse3 DESTINATION lib/erasure-code)
+endif(INTEL_SSE)
+
+# ec_shec_sse4
+if(INTEL_SSE4_1)
+  add_library(ec_shec_sse4 SHARED ${shec_srcs})
+  add_dependencies(ec_shec_sse4 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
+  target_link_libraries(ec_shec_sse4 ${EXTRALIBS})
+  set_target_properties(ec_shec_sse4 PROPERTIES VERSION 2.0.0 SOVERSION 2
+    COMPILE_FLAGS ${SSE4_FLAGS})
+  install(TARGETS ec_shec_sse4 DESTINATION lib/erasure-code)
+endif(INTEL_SSE4_1)
+
+add_library(ec_shec SHARED ErasureCodePluginSelectShec.cc)
+add_dependencies(ec_shec ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
+target_link_libraries(ec_shec ${EXTRALIBS})
+set_target_properties(ec_shec PROPERTIES VERSION 2.0.0 SOVERSION 2)
+install(TARGETS ec_shec DESTINATION lib/erasure-code)