Optimize default compile to compilation platform by default
Summary: This diff changes compile to optimize for native platform by default. This will automatically turn on crc32 optimizations for modern processors, which greatly improves rocksdb's performance. I also did some more changes to compilation documentation. Test Plan: compile with `make`, observe -march=native compile with `PORTABLE=1 make`, observe no -march=native Reviewers: sdong, rven, yhchiang, MarkCallaghan Reviewed By: MarkCallaghan Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D30225
This commit is contained in:
parent
cef6f84393
commit
06eed650a0
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
### Unreleased Features
|
### Unreleased Features
|
||||||
* Changed the LRU caching algorithm so that referenced blocks (by iterators) are never evicted
|
* Changed the LRU caching algorithm so that referenced blocks (by iterators) are never evicted
|
||||||
|
* By default we now optimize the compilation for the compilation platform (using -march=native). If you want to build portable binary, use 'PORTABLE=1' before the make command.
|
||||||
|
|
||||||
### 3.9.0 (12/8/2014)
|
### 3.9.0 (12/8/2014)
|
||||||
|
|
||||||
|
16
INSTALL.md
16
INSTALL.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
RocksDB's library should be able to compile without any dependency installed,
|
RocksDB's library should be able to compile without any dependency installed,
|
||||||
although we recommend installing some compression libraries (see below).
|
although we recommend installing some compression libraries (see below).
|
||||||
We do depend on newer gcc with C++11 support.
|
We do depend on newer gcc/clang with C++11 support.
|
||||||
|
|
||||||
There are few options when compiling RocksDB:
|
There are few options when compiling RocksDB:
|
||||||
|
|
||||||
@ -15,9 +15,9 @@ There are few options when compiling RocksDB:
|
|||||||
* `make all` will compile our static library, and all our tools and unit tests. Our tools
|
* `make all` will compile our static library, and all our tools and unit tests. Our tools
|
||||||
depend on gflags. You will need to have gflags installed to run `make all`.
|
depend on gflags. You will need to have gflags installed to run `make all`.
|
||||||
|
|
||||||
* if Intel SSE instruction set is supported, set USE_SSE=" -msse -msse4.2 " to make sure
|
* By default the binary we produce is optimized for the platform you're compiling on
|
||||||
SSE4.2 is used to speed up CRC32 when calculating data checksum.
|
(-march=native). If you want to build a portable binary, add 'PORTABLE=1' before
|
||||||
|
your make commands, like this: `PORTABLE=1 make static_lib`
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
@ -76,13 +76,7 @@ SSE4.2 is used to speed up CRC32 when calculating data checksum.
|
|||||||
* Install via [homebrew](http://brew.sh/).
|
* Install via [homebrew](http://brew.sh/).
|
||||||
* If you're first time developer in MacOS, you still need to run: `xcode-select --install` in your command line.
|
* If you're first time developer in MacOS, you still need to run: `xcode-select --install` in your command line.
|
||||||
* run `brew tap homebrew/dupes; brew install gcc47 --use-llvm` to install gcc 4.7 (or higher).
|
* run `brew tap homebrew/dupes; brew install gcc47 --use-llvm` to install gcc 4.7 (or higher).
|
||||||
* Install zlib, bzip2 and snappy libraries for compression.
|
* run `brew install rocksdb`
|
||||||
* Install gflags. We have included a script
|
|
||||||
`build_tools/mac-install-gflags.sh`, which should automatically install it (execute this file instead of runing using "source" command).
|
|
||||||
If you installed gflags by other means (for example, `brew install gflags`),
|
|
||||||
please set `LIBRARY_PATH` and `CPATH` accordingly.
|
|
||||||
* Please note that some of the optimizations/features are disabled in OSX.
|
|
||||||
We did not run any production workloads on it.
|
|
||||||
|
|
||||||
* **iOS**:
|
* **iOS**:
|
||||||
* Run: `TARGET_OS=IOS make static_lib`. When building the project which uses rocksdb iOS library, make sure to define two important pre-processing macros: `ROCKSDB_LITE` and `IOS_CROSS_COMPILE`.
|
* Run: `TARGET_OS=IOS make static_lib`. When building the project which uses rocksdb iOS library, make sure to define two important pre-processing macros: `ROCKSDB_LITE` and `IOS_CROSS_COMPILE`.
|
||||||
|
@ -308,8 +308,12 @@ if test "$USE_HDFS"; then
|
|||||||
JAVA_LDFLAGS="$JAVA_LDFLAGS $HDFS_LDFLAGS"
|
JAVA_LDFLAGS="$JAVA_LDFLAGS $HDFS_LDFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if Intel SSE instruction set is supported, set USE_SSE=" -msse -msse4.2 "
|
if test "$USE_SSE"; then
|
||||||
COMMON_FLAGS="$COMMON_FLAGS $USE_SSE"
|
# if Intel SSE instruction set is supported, set USE_SSE=1
|
||||||
|
COMMON_FLAGS="$COMMON_FLAGS -msse -msse4.2 "
|
||||||
|
elif test -z "$PORTABLE"; then
|
||||||
|
COMMON_FLAGS="$COMMON_FLAGS -march=native -mtune=native "
|
||||||
|
fi
|
||||||
|
|
||||||
PLATFORM_CCFLAGS="$PLATFORM_CCFLAGS $COMMON_FLAGS"
|
PLATFORM_CCFLAGS="$PLATFORM_CCFLAGS $COMMON_FLAGS"
|
||||||
PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS $COMMON_FLAGS"
|
PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS $COMMON_FLAGS"
|
||||||
|
@ -48,7 +48,7 @@ LIBUNWIND_REV=2c060e64064559905d46fd194000d61592087bdc
|
|||||||
LIBUNWIND="/mnt/gvfs/third-party2/libunwind/$LIBUNWIND_REV/1.1/gcc-4.8.1-glibc-2.17/675d945/lib/libunwind.a"
|
LIBUNWIND="/mnt/gvfs/third-party2/libunwind/$LIBUNWIND_REV/1.1/gcc-4.8.1-glibc-2.17/675d945/lib/libunwind.a"
|
||||||
|
|
||||||
# use Intel SSE support for checksum calculations
|
# use Intel SSE support for checksum calculations
|
||||||
export USE_SSE=" -msse -msse4.2 "
|
export USE_SSE=1
|
||||||
|
|
||||||
BINUTILS="/mnt/gvfs/third-party2/binutils/2aff2e7b474cd3e6ab23495ad1224b7d214b9f8e/2.21.1/centos6-native/da39a3e/bin"
|
BINUTILS="/mnt/gvfs/third-party2/binutils/2aff2e7b474cd3e6ab23495ad1224b7d214b9f8e/2.21.1/centos6-native/da39a3e/bin"
|
||||||
AR="$BINUTILS/ar"
|
AR="$BINUTILS/ar"
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Install gflags for mac developers.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
DIR=`mktemp -d /tmp/rocksdb_gflags_XXXX`
|
|
||||||
|
|
||||||
cd $DIR
|
|
||||||
wget https://gflags.googlecode.com/files/gflags-2.0.tar.gz
|
|
||||||
tar xvfz gflags-2.0.tar.gz
|
|
||||||
cd gflags-2.0
|
|
||||||
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
# Add include/lib path for g++
|
|
||||||
echo 'export LIBRARY_PATH+=":/usr/local/lib"' >> ~/.bash_profile
|
|
||||||
echo 'export CPATH+=":/usr/local/include"' >> ~/.bash_profile
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "-----------------------------------------------------------------------------"
|
|
||||||
echo "| Installation Completed |"
|
|
||||||
echo "-----------------------------------------------------------------------------"
|
|
||||||
echo "Please run \`. ~/.bash_profile\` to be able to compile with gflags"
|
|
Loading…
Reference in New Issue
Block a user