Heterogeneous Systems Jeffrey Young August 28th, 2012 SVN revision 2028 http://code.google.com/p/gpuocelot/ This document details the installation of Ocelot from the Subversion repository using Ubuntu 12.04 as the base OS. If you can use one of the prepackaged builds, this is recommended unless you need to use the latest features of Ocelot. If you run into any problems with the process in this document first try checking the wiki at http://code.google.com/p/gpuocelot/w/list and then the Google forum at https://groups.google.com/forum/#!forum/gpuocelot. 1) Make sure the required compilers and tools are installed: C++ compiler (≥GCC 4.5.x) Lex lexer generator (≥ Flex 2.5.35) YACC parser generator ( ≥Bison 2.4.1) Scons build tool Subversion sudo apt­get install flex bison scons build­essential subversion 2) Get the source code from Google Code. Note that this pulls the entire trunk with all tests and examples, which is very large svn checkout http://gpuocelot.googlecode.com/svn/

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Ocelot Installation Manual

A Dynamic Compilation Framework for Heterogeneous Systems


Jeffrey Young
August 28th, 2!2
S"# re$ision 228
http%&&co'e(google(com&p&gpuocelot&
)his 'ocument 'etails the installation of *celot from the Su+$ersion repository using ,+untu !2(- as
the +ase *S( .f you can use one of the prepackage' +uil's, this is recommen'e' unless you nee' to use
the latest features of *celot(
.f you run into any pro+lems with the process in this 'ocument first try checking the wiki at
http%&&co'e(google(com&p&gpuocelot&w&list an' then the /oogle forum at
https%&&groups(google(com&forum&01forum&gpuocelot(
1) Make sure the required compilers and tools are installed:
C22 compiler 34 /CC -(5(67
8e6 le6er generator 34 Fle6 2(5(957
YACC parser generator 3 4 :ison 2(-(!7
Scons +uil' tool
Su+$ersion
sudo apt-get install flex bison scons build-essential subversion
2) Get the source code from Google Code.
#ote that this pulls the entire trunk with all tests an' e6amples, which is $ery large
svn checkout http://gpuocelot.googlecode.com/svn/trunk/ gpuocelot-read-only
.f you 'on;t want any test co'e or e6amples, you can pull <ust the source 'irectory for *celot%
s$n checkout http%&&gpuocelot(googleco'e(com&s$n&trunk&ocelot&ocelot&
gpuocelot-read-only
3) Install LLM if !ou "ant to use different #ack$ends %&'() *M+) etc.)
.f you are running an *S that supports a $ersion of 88"= 4 9(!
sudo apt-get install llvm
For *S;s that support $ersions of 88"= > 9(! 3for instance, ,+untu !2(- uses 2(? +y 'efault7,
you;ll nee' to pull the latest $ersion from the 88"= S"# repository( *therwise when running *celot;s
+uil' script you may run into the following error%
ocelot/ir/implementation/ExternalFunctionSet.cpp: In function 'llvm::Function*
ir::jitFunction(const ir::ExternalFunctionSet::ExternalFunction&, const
ir::PTXKernel::Prototype&, llvm::Module*)':
ocelot/ir/implementation/ExternalFunctionSet.cpp:320:9: error: 'class
llvm::SMDiagnostic' has no member named 'print'
)o pull from the 88"= S"# an' +uil'%
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
./configure --enable-optimized
sudo make
sudo make install
,) Install -oost) Li#Gle") and Li#Glut
:oost 34 !(-(@ suggeste'7%
sudo apt-get install libboost-dev libboost-system-dev libboost-filesystem-dev
libboost-thread-dev
8i+glew 3$ersion !(@7 is use' to support *pen/8 features use' in some of the SDA e6amples
sudo apt-get install libglew1.6-dev
B#ote that this will install a large num+er of support li+raries as 'epen'encies(
)o install 8i+/lut 3use' +y some of the test applications in the C,DA SDA7
sudo apt-get install freeglut3 freeglut3-dev
.) /ther notes %Items that are not needed for installation)
Hy'raCine is checke' out automatically with the trunk of /D,*celot( )his fol'er contains some utility
functionality like a JS*# parser, floatingBpoint functions, +itBwise operations, casts, an' e6ception
o+<ects(
li+rt(so is use' for some of the SDA e6amples, an' refers to 8inu6 realBtime functionality( )his li+rary
is installe' +y 'efault with /CC as part of li+c, so there is no nee' to install any a''itional packages to
pro$i'e this li+rary( Dlease note that li+rt was mentione' as ErtF or Ert9(8F in pre$ious installation
gui'es, +ut in ,+untu this refers to the reGuestBtracker package(
()-uild /celot using the #uild.p! script:
cd gpuocelot-read-only 3or cd gpuocelot-read-only/ocelot to only +uil' the ocelot li+rary7
sudo build.py --install
.f *celot finishes compiling correctly, the *celot li+rary shoul' +e installe' in
H&usr&local&li+&li+ocelot(soH or can +e foun' locally un'er the H(releaseI+uil'H 'irectory(
0)-uilding tests:
You can either +uil' tests using the +uil'(py script in the root 'irectory of the trunk 3topBle$el
HgpuocelotBrea'BonlyH 'irectory checke' out from S"#7 or in the specific test 'irectory using the scons
+uil' tool an' the local SConscript file( .t is recommen'e' that you use the highBle$el +uil'(py script as
this will reGuire fewer changes to the files in each 'irectory(
)o +uil' test fol'ers%
sudo ./build.py --test_lists <test_folder_name> --test_level=<basic or full>
An e6ample of +uil'ing one test fol'er%
sudo ./build.py --test_lists parboil --test_level=basic
An e6ample of +uil'ing multiple test fol'ers%
sudo ./build.py --test_lists cuda4.1,parboil --test_level=full
.f you recei$e the following error while +uil'ing any of the tests with the +uil'(py script%
OSError: [Errno 2] No such file or directory: '../../.release_build/tests/cuda2.3
B/o to the topBle$el 'irectory 3HgpuocelotBrea'BonlyH7
Bsu'o mk'ir (releaseI+uil'&tests&cu'a2(9
BJerun the +uil' for your particular test, an' the compile' test applications shoul' now +e place' in the
correct release 'irectory(
To build all the tests in one folder using scons and local scripts (not recommended):
#ote that this step is not recommen'e' since +uil'(py can +e use' to +uil' all tests( )his metho' is
pro$i'e' only if you shoul' run into pro+lems with the +uil'(py script, or you want to mo$e test fol'ers
out of the normal 'irectory structure(
You will nee' to mo'ify the SConscript file in the test fol'er since you are calling it in the local
'irectory, not from the +uil'(py script in a higherBle$el 'irectory(
sys.path.append('../../scripts') ==> sys.path.append('../scripts')
Comment out env.Append(LIBPATH = [os.path.join(env['install_path'], 'lib')])
an' env.Append(CPPFLAGS = '-I' + os.path.join(env['install_path'], 'include'))
')-uilding applications "ith /celot
To link against Ocelot:
)o link against the *celot li+rary, you can use the *celotConfig tool as follows%
g++ -o my_program my_program.o `OcelotConfig -l`
The configure.ocelot file:
Kach test fol'er contains a file calle' configure(ocelot that can +e use' to set trace options an' specify
the 'e$ice that is use' to run the C,DA kernel 3ll$m, emulate', n$i'ia, am'7( :y 'efault, this file is set
to use the Hemulate'H 'e$ice( )ry running the same e6ample using 'ifferent 'e$ices such as Eemulate'F
or En$i'iaF so you can get a feel for the 'ifference in performance an' functionality of each 'e$ice(
For more information on creating an' mo'ifying these files see
http%&&co'e(google(com&p&gpuocelot&wiki&*celotConfigFile
An example individual compilation of a test program from the 4.1 !"# $lock:
.nput Files%
clock(cu B =ain C,DA file that launches kernel on the selecte' 'e$ice 3 as configure' through
configure(ocelot7
clockIkernel(cu B timing kernel that runs on the /D,
.nterme'iate *utput Files%
clock(cu(cpp, clockIkernel(cu(cpp B interme'iate file that contains the C,DA co'e from the kernel
3con$erte' to D)L7 em+e''e' as an array of +ytes( #"CC generates this interme'iate file in case you
nee' to compile your C,DA co'e with other C22 files or languages like *pen=D or =D.( You can
skip this interme'iate step +y passing the HBcH option to n$cc 3e(g(, En$cc Bc myprogram(cuF7(
&&,se #"CC without Bc flag to compile the clock kernel to an interme'iate cu(cpp file
/usr/local/cuda/bin/nvcc -I. -I/usr/local/cuda/include -arch=sm_20 -I./tests/clock
-I./shared -I./sdk -I. tests/clock/clock.cu -cuda -o tests/clock/clock.cu.cpp
/usr/local/cuda/bin/nvcc -I. -I/usr/local/cuda/include -arch=sm_20 -I./tests/clock
-I./shared -I./sdk -I. tests/clock/clock_kernel.cu -cuda -o
tests/clock/clock_kernel.cu.cpp
&&,se g22 to compile each of the cu(cpp files to cu(o 3o+<ect7 files( )his allows for finerBgraine'
&&compilation(
g++ -o tests/clock/clock_kernel.cu.o -c -Wall -O2 -g -I. -I/usr/local/cuda/include
-std=c++0x -I./shared -I./sdk -I. -I./tests/clock -I./shared -I./sdk -I.
tests/clock/clock_kernel.cu.cpp
g++ -o tests/clock/clock.cu.o -c -Wall -O2 -g -I. -I/usr/local/cuda/include
-std=c++0x -I./shared -I./sdk -I. -I./tests/clock -I./shared -I./sdk -I.
tests/clock/clock.cu.cpp
&&8ink against *celot( #ote that li+/lew an' li+/lut are also linke' in for this test
g++ -o Clock tests/clock/clock_kernel.cu.o tests/clock/clock.cu.o
-L/usr/local/cuda/lib64 -lglut -locelot libsdk4_1.a -lGLEW -lGLU
More information
For more information on any of the a+o$e topics, please check our wiki at
http%&&co'e(google(com&p&gpuocelot&w&list or the /oogle forum at https%&&groups(google(com&forum&01
forum&gpuocelot

You might also like