Below in the dropbox link is a standalone benchmarking example for performing Cholesky Decomposition in ViennaCL and Eigen. It compiles via g++ with the -lOpenCL
compiler flag. This requires having OpenCL (Whether through NVIDIA or AMD) installed on your computer as well as a GPU.
Running make
will create eigen_vienna_LU_compare.o
which will run the benchmark and give output such as the one below. These results come from an NVIDIA GTX 780. For the largest matrix example, the 3600x3600 case, ViennaCL with an OpenCL backend gives a 17.5x speedup relative to the LLT of Eigen and a 35.7x speed up relative to the LU of Eigen. The U in the ViennaCL and Eigen LU decomposition is transposed and then divided column wise by the matrices diagonal elements to give the L of the Cholesky. Results match across Eigen and ViennaCL up to my computers double machine precision 2.22045e-16
.
In the meeting today we discussed next steps as something like Rob and I speaking about how to integrate this with auto-diff. The code is fairly simple so I have hopes this will actually be nice!
I would suggest at this point someone reviews the code to replicate my results. If you do, please post your GPU make/model, the benchmark, and if possible the results from running a deviceQuery (which should be in the samples/1_Utilities
folder if you are running nvcc)
Note: ViennaCL actually gives a number of GPU devices which they have tested on and you can view here
Benchmark Results
-- Times for 16x16 Matrix --
Precision: 2.22045e-16
Time for Partial Pivot LU (Eigen): 0.000705
----------------------------------------------
Time for LLT (Eigen): 0.000322
----------------------------------------------
Time for LU (ViennaCL): 0.000166
----------------------------------------------
Eigen LU Partial Pivot and ViennaCL Lower Diagonal Match!
----------------------------------------------
Eigen LLT and ViennaCL Lower Diagonal Match!
----------------------------------------------
-- Times for 100x100 Matrix --
Precision: 2.22045e-16
Time for Partial Pivot LU (Eigen): 0.004182
----------------------------------------------
Time for LLT (Eigen): 0.002207
----------------------------------------------
Time for LU (ViennaCL): 0.00578
----------------------------------------------
Eigen LU Partial Pivot and ViennaCL Lower Diagonal Match!
----------------------------------------------
Eigen LLT and ViennaCL Lower Diagonal Match!
----------------------------------------------
-- Times for 400x400 Matrix --
Precision: 2.22045e-16
Time for Partial Pivot LU (Eigen): 0.173933
----------------------------------------------
Time for LLT (Eigen): 0.084297
----------------------------------------------
Time for LU (ViennaCL): 0.038564
----------------------------------------------
Eigen LU Partial Pivot and ViennaCL Lower Diagonal Match!
----------------------------------------------
Eigen LLT and ViennaCL Lower Diagonal Match!
----------------------------------------------
-- Times for 900x900 Matrix --
Precision: 2.22045e-16
Time for Partial Pivot LU (Eigen): 1.84785
----------------------------------------------
Time for LLT (Eigen): 0.872908
----------------------------------------------
Time for LU (ViennaCL): 0.179966
----------------------------------------------
Eigen LU Partial Pivot and ViennaCL Lower Diagonal Match!
----------------------------------------------
Eigen LLT and ViennaCL Lower Diagonal Match!
----------------------------------------------
-- Times for 1600x1600 Matrix --
Precision: 2.22045e-16
Time for Partial Pivot LU (Eigen): 9.91686
----------------------------------------------
Time for LLT (Eigen): 4.83424
----------------------------------------------
Time for LU (ViennaCL): 0.576174
----------------------------------------------
Eigen LU Partial Pivot and ViennaCL Lower Diagonal Match!
----------------------------------------------
Eigen LLT and ViennaCL Lower Diagonal Match!
----------------------------------------------
-- Times for 3600x3600 Matrix --
Precision: 2.22045e-16
Time for Partial Pivot LU (Eigen): 109.988
----------------------------------------------
Time for LLT (Eigen): 53.9652
----------------------------------------------
Time for LU (ViennaCL): 3.07835
----------------------------------------------
Eigen LU Partial Pivot and ViennaCL Lower Diagonal Match!
----------------------------------------------
Eigen LLT and ViennaCL Lower Diagonal Match!
----------------------------------------------
deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 780"
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 3.5
Total amount of global memory: 3018 MBytes (3164209152 bytes)
(12) Multiprocessors, (192) CUDA Cores/MP: 2304 CUDA Cores
GPU Max Clock rate: 902 MHz (0.90 GHz)
Memory Clock rate: 3004 Mhz
Memory Bus Width: 384-bit
L2 Cache Size: 1572864 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 780
Result = PASS