sym_num

sym_num

Matrix calculation with cuBLAS

Hello
I started new project.
It uses cuBLAS to calculate matrix products.
It uses NIFs.
I want to apply it to Deep Learning.
https://github.com/sasagawa888/cumatrix

Most Liked

sym_num

sym_num

I have updated to the latest version of Elixir ver1.10. I have modified cuMatrix to work.

sym_num

sym_num

I wrote addition, subtraction and multiplication code in CUDA and cuBLAS. So I measured it and compared it with the Matrix library.
Multiplication is fast, but addition and subtraction are not much different.

------ cuMatrix ----------------
iex(1)> a = Cumatrix.new(1000,1000,:rand);0
0
iex(2)> b = Cumatrix.new(1000,1000,:rand);0
0
iex(3)> require(Time)
nil
iex(4)> Time.time(Cumatrix.mult(a,b));0
“time: 226896 micro second”
“-------------”
0
iex(5)> Time.time(Cumatrix.mult(a,b));0
“time: 67511 micro second”
“-------------”
0
iex(6)> Time.time(Cumatrix.mult(a,b));0
“time: 33814 micro second”
“-------------”
0
iex(7)> Time.time(Cumatrix.add(a,b));0
“time: 24058 micro second”
“-------------”
0
iex(8)> Time.time(Cumatrix.add(a,b));0
“time: 31787 micro second”
“-------------”
0
iex(9)> Time.time(Cumatrix.add(a,b));0
“time: 28815 micro second”
“-------------”
0
iex(10)> Time.time(Cumatrix.sub(a,b));0
“time: 27208 micro second”
“-------------”
0
iex(11)> Time.time(Cumatrix.sub(a,b));0
“time: 25860 micro second”
“-------------”
0
iex(12)> Time.time(Cumatrix.sub(a,b));0
“time: 24574 micro second”
“-------------”
0

------ Matrix ---------------------
iex(1)> a = Matrix.rand(1000,1000);0
0
iex(2)> b = Matrix.rand(1000,1000);0
0
iex(3)> require(Time)
nil
iex(4)> Time.time(Matrix.mult(a,b));0
“time: 29913660 micro second”
“-------------”
0
iex(5)> Time.time(Matrix.mult(a,b));0
“time: 30599437 micro second”
“-------------”
0
iex(6)> Time.time(Matrix.mult(a,b));0
“time: 30030455 micro second”
“-------------”
0
iex(7)> Time.time(Matrix.add(a,b));0
“time: 21835 micro second”
“-------------”
0
iex(8)> Time.time(Matrix.add(a,b));0
“time: 84429 micro second”
“-------------”
0
iex(9)> Time.time(Matrix.add(a,b));0
“time: 76458 micro second”
“-------------”
0
iex(10)> Time.time(Matrix.sub(a,b));0
“time: 22082 micro second”
“-------------”
0
iex(11)> Time.time(Matrix.sub(a,b));0
“time: 25556 micro second”
“-------------”
0
iex(12)> Time.time(Matrix.sub(a,b));0
“time: 25680 micro second”
“-------------”
0

sym_num

sym_num

I was encouraged.
The loss function, the activation function, and the differential calculation are also added. I will start GPU version of Deep Pipe2.

Last Post!

sym_num

sym_num

I improved the data structure with reference to Matrex code. Speed up.
Thanks to Mr. versilov.

iex(1)> m = Cumatrix.new([[1.0,2.0],[3.0,4.0]])
{2, 2, <<0, 0, 128, 63, 0, 0, 64, 64, 0, 0, 0, 64, 0, 0, 128, 64>>}
iex(2)> Cumatrix.print(Cumatrix.mult(m,m))
7.000000 10.000000
15.000000 22.000000

true
iex(3)> a = Cumatrix.rand(1000,1000);0
0
iex(4)> b = Cumatrix.rand(1000,1000);0
0
iex(5)> require(Time)
Time
iex(6)> Time.time(Cumatrix.mult(a,b));0
“time: 14599 micro second”
“-------------”
0
iex(7)> Time.time(Cumatrix.mult(a,b));0
“time: 12263 micro second”
“-------------”
0
iex(8)> Time.time(Cumatrix.mult(a,b));0
“time: 11781 micro second”

Where Next?

Popular in Discussions Top

AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
shishini
I think this twitter post and youtube video didn’t get as much attention as I hoped I am still new to Elixir, so can’t really judge ...
New

Other popular topics Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement