The bottleneck in my code is the area where I calculate a pairwise distance matrix. Since this is the slowest part by far, I have spent much time in speeding up my code.
I have found many speedups using articles online, but the gains have been minimal. So, I am looking for a method to use my GPU to create a distance matrix in order to speed it up further. However, I know very little about using the GPU for computation. Can anyone help me do this?
In my research I have found the following, but none of them used the GPU:
- This article was useful, but the speedups were minimal.
- This article was informative on how to use cython and numba.
Here is an example snippet of how to calculate a pairwise distance matrix:
import numpy as np
from scipy import spatial
rows = 1000
cols = 10
mat = np.random.randn(rows, cols)
d_mat = spatial.distance.cdist(mat, mat)
My graphics card is an Nvidia Quadro M2000M
cuda
within thenumba
library to code this and I got significant speedups... Give me ~24 hours and I can find my code and post it here as an answer. – Salesroom