From 8fc20ac468b266a53083175025375985ec04b796 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Wed, 11 Mar 2020 12:31:06 -0700 Subject: [PATCH] Add ppc64le builds to Travis (#6144) Summary: Let's see how this goes... Pull Request resolved: https://github.com/facebook/rocksdb/pull/6144 Differential Revision: D20387515 Pulled By: pdillinger fbshipit-source-id: ba2669348c267141dfddff910b4c2224a22cbb38 --- .travis.yml | 27 +++++++++++++++++++++------ CMakeLists.txt | 23 ++++++++++++++++------- db/plain_table_db_test.cc | 4 ++-- util/xxh3p.h | 4 ++-- 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index feca073a5..717ccb121 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ language: cpp os: - linux - osx +arch: + - amd64 + - ppc64le compiler: - clang - gcc @@ -62,12 +65,22 @@ matrix: env: TEST_GROUP=4 - os: osx env: JOB_NAME=cmake-gcc8 - - os : osx + - os: osx env: JOB_NAME=cmake-mingw - - os : linux - compiler: clang - - os : osx + - os: osx + arch: ppc64le + - os: osx compiler: gcc + - os: linux + arch: ppc64le + env: JOB_NAME=cmake-mingw + - os: linux + compiler: clang + +before_install: + - if [[ "${JOB_NAME}" == java_test || "${JOB_NAME}" == cmake* ]] && [ "$(uname -m)" == ppc64le ]; then + sudo apt-get -y install openjdk-8-jdk && export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-ppc64el; + fi install: - if [ "${TRAVIS_OS_NAME}" == osx ]; then @@ -81,9 +94,11 @@ install: sudo apt-get install -y mingw-w64 ; fi - if [[ "${JOB_NAME}" == cmake* ]] && [ "${TRAVIS_OS_NAME}" == linux ]; then - mkdir cmake-dist && curl --silent --fail --show-error --location https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-Linux-x86_64.tar.gz | tar --strip-components=1 -C cmake-dist -xz && export PATH=$PWD/cmake-dist/bin:$PATH; + CMAKE_DIST_URL="https://github.com/pdillinger/rocksdb/releases/download/cmake-3.14.5/cmake-3.14.5-Linux-$(uname -m).tar.bz2"; + TAR_OPT="--strip-components=1 -xj"; + mkdir cmake-dist && curl --silent --fail --show-error --location "${CMAKE_DIST_URL}" | tar -C cmake-dist ${TAR_OPT} && export PATH=$PWD/cmake-dist/bin:$PATH; fi - - if [[ "${JOB_NAME}" == java_test ]]; then + - if [[ "${JOB_NAME}" == java_test || "${JOB_NAME}" == cmake* ]]; then java -version && echo "JAVA_HOME=${JAVA_HOME}"; fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 18413f173..4280b7b8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,16 +203,25 @@ else() endif() include(CheckCCompilerFlag) -if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") + CHECK_C_COMPILER_FLAG("-mcpu=power9" HAS_POWER9) + if(HAS_POWER9) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power9 -mtune=power9") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power9 -mtune=power9") + else() + CHECK_C_COMPILER_FLAG("-mcpu=power8" HAS_POWER8) + if(HAS_POWER8) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power8 -mtune=power8") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power8 -mtune=power8") + endif(HAS_POWER8) + endif(HAS_POWER9) CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC) if(HAS_ALTIVEC) message(STATUS " HAS_ALTIVEC yes") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maltivec") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power8") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power8") endif(HAS_ALTIVEC) -endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") +endif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64") CHECK_C_COMPILER_FLAG("-march=armv8-a+crc+crypto" HAS_ARMV8_CRC) @@ -235,7 +244,7 @@ else() if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2") else() - if(NOT HAVE_POWER8 AND NOT HAS_ARMV8_CRC) + if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64" AND NOT HAS_ARMV8_CRC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") endif() endif() @@ -741,11 +750,11 @@ if(HAVE_SSE42 AND NOT MSVC) PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") endif() -if(HAVE_POWER8) +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") list(APPEND SOURCES util/crc32c_ppc.c util/crc32c_ppc_asm.S) -endif(HAVE_POWER8) +endif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") if(HAS_ARMV8_CRC) list(APPEND SOURCES diff --git a/db/plain_table_db_test.cc b/db/plain_table_db_test.cc index d80cc4f67..d86d54db0 100644 --- a/db/plain_table_db_test.cc +++ b/db/plain_table_db_test.cc @@ -1275,7 +1275,7 @@ static std::string RandomString(Random* rnd, int len) { TEST_P(PlainTableDBTest, CompactionTrigger) { Options options = CurrentOptions(); - options.write_buffer_size = 120 << 10; // 100KB + options.write_buffer_size = 120 << 10; // 120KB options.num_levels = 3; options.level0_file_num_compaction_trigger = 3; Reopen(&options); @@ -1287,7 +1287,7 @@ TEST_P(PlainTableDBTest, CompactionTrigger) { std::vector values; // Write 120KB (10 values, each 12K) for (int i = 0; i < 10; i++) { - values.push_back(RandomString(&rnd, 12000)); + values.push_back(RandomString(&rnd, 12 << 10)); ASSERT_OK(Put(Key(i), values[i])); } ASSERT_OK(Put(Key(999), "")); diff --git a/util/xxh3p.h b/util/xxh3p.h index 0a3cd9808..1fc823203 100644 --- a/util/xxh3p.h +++ b/util/xxh3p.h @@ -637,7 +637,7 @@ XXH3p_accumulate_512( void* XXH_RESTRICT acc, } } -#elif (XXH_VECTOR == XXH_VSX) +#elif (XXH_VECTOR == XXH_VSX) && /* work around a compiler bug */ (__GNUC__ > 5) U64x2* const xacc = (U64x2*) acc; /* presumed aligned */ U64x2 const* const xinput = (U64x2 const*) input; /* no alignment restriction */ U64x2 const* const xsecret = (U64x2 const*) secret; /* no alignment restriction */ @@ -782,7 +782,7 @@ XXH3p_scrambleAcc(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) xacc[i] = vmlal_u32(xacc[i], shuffled.val[0], prime); } } -#elif (XXH_VECTOR == XXH_VSX) +#elif (XXH_VECTOR == XXH_VSX) && /* work around a compiler bug */ (__GNUC__ > 5) U64x2* const xacc = (U64x2*) acc; const U64x2* const xsecret = (const U64x2*) secret;