How to get distance of a distance matrix from weight and instances matrices with Eucledian Distance

I have two matrices one is W a weight vector matrix nxm and X is data matrix in the same size. I would like to find the Distance matrix D from W and X given Euclidean Distance metric. I plan to write it with CUBLAS since I head of a lot. However I am new to CUBLAS and BLAS, never used. Is there any tutorial to follow up or any master that can share any code snippet ?