GPU Library Page
m (→Windows Version) |
m (Gpu Library Page moved to GPU Library Page: GPU is correct not Gpu!) |
Revision as of 11:36, 8 January 2010
Contents |
Download Source Code
The source code for the library can be downloaded as stand alone from the following link.
As an alternative it can be downloaded together with the Kratos distribution
prviews release candidate available at Download OLD VERSION
Installation Instructions
Linux Version
Downloading and installing stuff
CUDA
First step will be download all CUDA stuff. CUDA needs a propietary nVidia driver, to enable CUDA interpretation, and a CUDA toolkit. Proceed to CUDA download page http://www.nvidia.com/object/cuda_get.html
Select your operating system type. In our case, we select linux, 32 or 64 bits depens of which platform we have. Choose the your linux distribution, in our case, ubuntu 9.04, and proceed to download the recommended driver and it's toolkit. If your system allows different CUDA versions, choose the newest one. Save both files in a folder, let me name it CUDA-TMP. Let's name driver as NVIDIA-DRIVER and toolkit CUDA-TOOLKIT.
Now, let's install driver:
Press cntrl + alt + F1
Log in
cd /path/to/CUDA-TMP sudo /etc/init.d/gdm stop (if you're using KDE, use kdm instead of gdm) sudo ./NVIDIA-DRIVER
follow the nvidia assistant instructions
sudo /etc/init.d/gdm start (again, if your're using KDE, use kdm)
Press cntrl + alt + F7 Open a terminal
sudo gedit /etc/default/linux-restricted-modules-common
add 'nv' to DISABLED_MODULES ( DISABLED_MODULES=”nv” ) save and quit gedit Driver is installed now, and all changes will be load when you restart computer. Let's install cuda toolkit:
sudo sh ./CUDA-TOOLKIT
type your password press enter when assistant asks the path to CUDA CUDA is now installed in our system, but not configured yet.
LAPACKPP
Download lapack++ from http://lapackpp.sourceforge.net/ Press the link to Download page, and select the last version of lapack++ (we used 2.5.3 version for our tests). Save the file in a folder, let me name it LAPACKPP-TMP. Installation steps (assuming installing from the user root directory):
mkdir LAPACKPP-TMP cd LAPACKPP-TMP ./configure –prefix=/usr/local/lapackpp make sudo make install
Environment configuration Environment variables open a terminal gedit $HOME/.bashrc go to the bottom of file type the following sentences, each one in a new line
#CUDA stuff PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib export PATH export LD_LIBRARY_PATH
restart the terminal
Library open a terminal
sudo gedit /etc/ld.so.conf type your password
add in the end of file, two new lines
/usr/local/cuda/lib /usr/local/lapackpp/lib
save and close. Now type the following in the same terminal
sudo ldconfig
Now, the system is well configured
Making the library
Download our gpu library to a folder, let me name it GPU-TMP. open a terminal
cd /path/to/GPU-TMP make -f Makefile_lib
The following command is only for your architecture. If you have a 32bit Operating System, you must type:
make -f Makefile_test
Instead, if you have a 64bit Operating System, you must type:
make -f Makefile_test_64
Now run the test
./test
Windows Version
Dependencies.
CUDA.
Driver.
Download driver from CUDA downloads page.
http://www.nvidia.com/object/cuda_get.html
Select your desired CUDA version and download the recommended driver in that section. Our choice is CUDA 2.3. When file is downloaded, execute it, and follow nVidia instructions. Older driver will be deleted and replaced with this new one. Toolkit.
Download toolkit form the CUDA download page, the one recommended from the version you choose, under the same URL used in the previous step.
http://www.nvidia.com/object/cuda_get.html
When file is downloaded, execute it, and follow instructions. Use default CUDA paths if you want to compile project without changing path dependencies.
Download SDK from the CUDA download page, the one recommended from the version you choose, under the same URL used in the previous step.
http://www.nvidia.com/object/cuda_get.html
When file is downloaded, execute it, and follow instructions. Use default CUDA paths if you want to compile project without changing path dependencies. After this step, copy Cuda.rules under CUDA SDK folder, to your Visual Studio rules folder, to allow the use of that file from your projects.
Lapackpp.
Download and install exe Download the exe file from the following URL.
http://sourceforge.net/projects/lapackpp/
This file provides the system with needed libraries to compile Lapackpp. Use default path to install recommended from installer if you don't want to change the final project's configuration.
Download project and compilation.
Download last version of lapackpp project from the following URL.
http://sourceforge.net/projects/lapackpp/files/
In our case, it will be 2.5.3. Open the project in uncompressed folder with Visual Studio. The solution contains several projects. Check if all paths are correctly, this is, checking the paths to the library and include directories from the previous step (installation of needed libraries for lapackpp), and then, proceed to compile from top to bottom projects. Don't compile the entire solution, you must compile each project alone, and in the correct order, because each project have dependencies from the previous ones. Distribution of libraries The result of the previous step will be several libraries. We will use only 2: One static and one dynamic. Move LAPACKPP.lib to the folder where you installed the exe file, under \lib folder; it should be c:\Program files\lapackpp\lib. Then, you must move the dynamic library under the same folder that previous one, to the release and debug folders of any project where you will use lapackpp. To compile lapack++ for 64 bit Windows, check out this page: Compiling lapack++ for 64 bit Windows
Library compilation.
Downloading the library.
Download the library from the following url
http://kratos.cimne.upc.es/kratoswiki/index.php/Gpu_Library_Page
Compiling library.
Open the solution from previous step with Visual Studio 2005. Just build the first project; by default, it is compiled in release mode, but you can try debug, all is well configured if you have default paths for lapackpp and CUDA. The result from this step is a static library.
Compiling example.
The second project from the previous solution is the test. Just build it. The results will be an executable file in release mode.
Executing example.
Open a terminal, navigate to your project, under release or debug folder (it will depends on which one you choose), and execute the exe file generated.