Difference between revisions of "User:Hef/ispc on rpi2"
< User:Hef
Jump to navigation
Jump to search
(19 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | == setup == | ||
+ | gcc 4.6 both won't compile latest llvm/clang and will generate an ICE on older versions of clang. | ||
+ | |||
<syntaxHighlight lang=bash> | <syntaxHighlight lang=bash> | ||
− | sudo apt-get install cmake gcc-4.8 g++-4.8 | + | sudo apt-get install cmake gcc-4.8 g++-4.8 bison flex libncurses5-dev subversion |
+ | </syntaxHighlight> | ||
+ | |||
+ | == second attempt == | ||
+ | |||
+ | <syntaxHighlight lang=bash> | ||
+ | export LLVM_HOME=~/projects/llvm_home | ||
+ | export ISPC_HOME=$PWD | ||
+ | export CC=/usr/bin/gcc-4.8 | ||
+ | export CXX=/usr/bin/g++-4.8 | ||
+ | export CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4" | ||
+ | export CXXFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4" | ||
+ | ./alloy.py -b --version=3.5 | ||
+ | export PATH=$PATH:$LLVM_HOME/bin-3.5/bin | ||
+ | |||
+ | </syntaxHighlight> | ||
+ | |||
+ | I should try adding <code>export CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4"</code> | ||
+ | |||
+ | == first attempt == | ||
+ | |||
+ | === ninja === | ||
+ | <syntaxHighlight lang=bash> | ||
+ | git clone git://github.com/martine/ninja.git | ||
+ | cd ninja | ||
+ | git checkout release | ||
+ | ./configure.py --bootstrap | ||
+ | sudo cp ninja /usr/local/bin/ninja | ||
+ | </syntaxHighlight> | ||
+ | |||
+ | === clang === | ||
+ | <syntaxHighlight lang=bash> | ||
+ | git clone http://llvm.org/git/llvm.git | ||
+ | cd llvm/tools | ||
+ | git clone http://llvm.org/git/clang.git | ||
+ | cd ../../.. | ||
+ | mkdir llvm-build | ||
+ | cd llvm-build | ||
+ | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc-4.8 -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.8 ../llvm -G Ninja | ||
+ | ninja -j1 | ||
+ | </syntaxHighlight> | ||
+ | |||
+ | Ninja will take many hours to complete. | ||
+ | I didn't fully test the <code>-j</code> (concurrent build) options to ninja. ninja defaults to 6 on the rpi2. You will run out of memory if you do this. Even if you create larger swap for the pi, swapping to an sd card is a really major performance hit and you will be better of using fewer cores. | ||
+ | |||
+ | === self hosted clang === | ||
+ | <syntaxHighlight lang=bash> | ||
+ | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/local/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ ../llvm -G Ninja | ||
+ | </syntaxHighlight> | ||
+ | |||
+ | === ispc === | ||
+ | <syntaxHighlight lang=bash> | ||
+ | make ARM_ENABLED=1 -j4 | ||
</syntaxHighlight> | </syntaxHighlight> |
Latest revision as of 19:05, 27 March 2015
setup
gcc 4.6 both won't compile latest llvm/clang and will generate an ICE on older versions of clang.
sudo apt-get install cmake gcc-4.8 g++-4.8 bison flex libncurses5-dev subversion
second attempt
export LLVM_HOME=~/projects/llvm_home
export ISPC_HOME=$PWD
export CC=/usr/bin/gcc-4.8
export CXX=/usr/bin/g++-4.8
export CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4"
export CXXFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4"
./alloy.py -b --version=3.5
export PATH=$PATH:$LLVM_HOME/bin-3.5/bin
I should try adding export CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4"
first attempt
ninja
git clone git://github.com/martine/ninja.git
cd ninja
git checkout release
./configure.py --bootstrap
sudo cp ninja /usr/local/bin/ninja
clang
git clone http://llvm.org/git/llvm.git
cd llvm/tools
git clone http://llvm.org/git/clang.git
cd ../../..
mkdir llvm-build
cd llvm-build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc-4.8 -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.8 ../llvm -G Ninja
ninja -j1
Ninja will take many hours to complete.
I didn't fully test the -j
(concurrent build) options to ninja. ninja defaults to 6 on the rpi2. You will run out of memory if you do this. Even if you create larger swap for the pi, swapping to an sd card is a really major performance hit and you will be better of using fewer cores.
self hosted clang
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/local/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ ../llvm -G Ninja
ispc
make ARM_ENABLED=1 -j4