[petsc-dev] [GPU - slepc] Hands-on exercise 4 (SVD) not working with GPU and default configurations

Jose E. Roman jroman at dsic.upv.es
Tue Aug 11 10:51:31 CDT 2015


> El 11/8/2015, a las 12:17, Leoni, Massimiliano <Massimiliano.Leoni at rolls-royce.com> escribió:
> 
> Jose,
> 
> I have a doubt I made myself unclear earlier: when I said the GPU version was slower than the CPU version, I meant single GPU vs single CPU multithreaded [i.e. 12 threads].
> 
> The single GPU version is, at the moment, performing slightly better than the serial [1 CPU with one thread] version.
> For example, I ran my code reading a 40000x400 matrix I created sampling from a function [a sum of sines with different periods].
> The average execution time on a single CPU is 13.6s, the one on a single GPU is 8.4s; these are similar to the ones I get running the hands-on exercise on SVD out-of-the-box [accordingly to the fact that this portion of my code follows the outline of that example].
> 
> I am running on what I think is an optimised build, here are my configure options:
> PETSC_ARCH=linux-gpu-optimised
> --with-clanguage=c++
> --COPTFLAGS=-O3
> --CXXOPTFLAGS=-O3
> --CUDAOPTFLAGS=-O3
> --FOPTFLAGS=-O3
> --with-debugging=no
> --with-log=1
> --with-blas-lapack-dir=/opt/intel/mkl/
> --with-mpi-dir=/path/to/openmpi-1.8.6-gcc
> --with-openmp=1
> --with-hdf5-dir=/path/to/hdf5-1.8.15-patch1/
> --with-cuda=1
> --with-cuda-dir=/path/to/cuda-7.0
> --CUDAC=/path/to/nvcc
> --with-cusp=1
> --with-cusp-dir=/path/to/cusplibrary
> --with-cgns-dir=/path/to/CGNS/
> --with-cmake-dir=/path/to/cmake-3.2.3-Linux-x86_64/
> 
> Addressing the other point you raised: I am not scared of low-level programming, but I have quite a tight deadline to present results.
> 
> Best,
> 
> Massimiliano

Yes, seems ok. For the shell matrix version, you have to take care of memory management for the matrix at the GPU, and then use VecCUSPGetArrayRead, VecCUSPGetArrayWrite and VecCUSPGetCUDAArray to obtain the GPU pointer corresponding to the vectors x,y of the operation y=A*x.

Jose





More information about the petsc-dev mailing list