SERVING THE QUANTITATIVE FINANCE COMMUNITY

  • 1
  • 3
  • 4
  • 5
  • 6
  • 7
  • 17
 
User avatar
outrun
Posts: 4573
Joined: April 29th, 2016, 1:40 pm

Re: Looking for hardware recommendations

October 25th, 2016, 6:27 pm

I can try cuch's code on the GPU?
 
User avatar
Alan
Topic Author
Posts: 10033
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

Re: Looking for hardware recommendations

October 25th, 2016, 6:31 pm

I can try cuch's code on the GPU?
OK, great -- thanks. I hope to be proven wrong. 
 
User avatar
Cuchulainn
Posts: 61542
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Looking for hardware recommendations

October 25th, 2016, 6:36 pm

You can use the CUDA math toolkit which has all the primitive math function implemented for GPU

https://developer.nvidia.com/cuda-math-library
For this problem I only see problems with a GPU solution. The maths stuff is well, evolving.
For one thing we have not decided on how to create the algorithm for M(a,b,z). GPU is for SPMD problems.

Much better is to use PPL 9standard C++11 which I have tested for CHF (it has same running time as OpenMP).. Piece of cake.

// Parallel for uses a lambda function in closed-open range [first, last)
M = 1’000’000’000;
concurrency::parallel_for(std::size_t(0), M, [&](std::size_t i)
{
                std::complex<value_type> v = SN(z, N); // 3.2b
});
               




BTW head a rumour PPL -> C++17. All the more reason to use Visual Studio 2015. And Boost install is automagic

Piece of cake
https://sourceforge.net/projects/boost/
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
 
User avatar
Cuchulainn
Posts: 61542
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Looking for hardware recommendations

October 25th, 2016, 6:44 pm

I can try cuch's code on the GPU?
OK, great -- thanks. I hope to be proven wrong. 
I can send a small test code for 3.2b. Then it is up to you gents to write loops to test speedup.
OK?

Even better before CUDA, try on C++AMP, quicker turn around time for POC purposes.

My hunch is that GPU maths and not its high-octane engine will let you down.
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
 
User avatar
outrun
Posts: 4573
Joined: April 29th, 2016, 1:40 pm

Re: Looking for hardware recommendations

October 25th, 2016, 6:47 pm

thanks, that would be nice, 

...it's this one, right?
Image
 
User avatar
outrun
Posts: 4573
Joined: April 29th, 2016, 1:40 pm

Re: Looking for hardware recommendations

October 25th, 2016, 6:52 pm

GPU math is provided NVIDIA, claims to give the exact same results as CPU libs 
 
User avatar
Cuchulainn
Posts: 61542
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Looking for hardware recommendations

October 25th, 2016, 6:53 pm

thanks, that would be nice, 

...it's this one, right?
Image
Yep!
a, b real
z complex.
See also the stopping criterion in that article, take exp(5.0, 0.)) as 101 test case and report on findings (Speedup plus accuracy)

Compare with native CUDA exp(z) (I doubt if there is one).
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
 
User avatar
outrun
Posts: 4573
Joined: April 29th, 2016, 1:40 pm

Re: Looking for hardware recommendations

October 25th, 2016, 7:38 pm

excellent. I'll do those same cases you did.

I won't be able to do it today, ..I had lunch at frolloos place, .struggling with food poisoning right now,  he had warned me beforehand!
 
User avatar
BramJ
Posts: 372
Joined: January 10th, 2006, 2:01 pm

Re: Looking for hardware recommendations

October 25th, 2016, 7:46 pm

Depending on what type of Mathematica license you have, you could also look at installing Mathematica on an EC2 instance of your liking (firing it up only when needed) and connect from your laptop to the kernel there. Haven't done this myself, but here are some instructions: https://mathematica.stackexchange.com/q ... ect-to-ec2.

When I recently decided to replace my laptop, I bought regular desktop, but from a bit of googling around it seems like it's actually quite common for a lot of people to just buy a netbook and just use AWS for all there more heavy computing needs.
 
User avatar
Cuchulainn
Posts: 61542
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Looking for hardware recommendations

October 25th, 2016, 8:56 pm

excellent. I'll do those same cases you did.

I won't be able to do it today, ..I had lunch at frolloos place, .struggling with food poisoning right now,  he had warned me beforehand!
Spicey food? yummy
Looking forward to GPU results, it is a very good benchmark?
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
 
User avatar
outrun
Posts: 4573
Joined: April 29th, 2016, 1:40 pm

Re: Looking for hardware recommendations

October 25th, 2016, 9:23 pm

Foul food, like bacteria and stuff.

I'm using a stopping condition like this now (both real and imaginary):
abs(S2 - S1) < eps*S2

This is the first type I'm coding C++ on GPU, I use my GPU mainly with higher level frameworks & python.
 
User avatar
outrun
Posts: 4573
Joined: April 29th, 2016, 1:40 pm

Re: Looking for hardware recommendations

October 26th, 2016, 8:07 am

got something working just now (before going to the dentist, but need to go to my client now)

* I'm using float instead of double. I expect double to be twice as slow. I picked float because I think it's interesting, and the example I modifies was in float. I can do double too.
* I'm used 20 iterations of algorithm 3.2b. It didn't converge, there is a bug somewhere I think, the results are wrong too. The number of multiplications / divisions is probably not going to change much when I fix it
*tested it with a low end NVidia GTX 970 with 1664 core

For this case: 
M[ 1.000000, 4.000000, 0.000000 + 50.000000i ] -> 2.99 E9 evalutation  / sec
 
User avatar
outrun
Posts: 4573
Joined: April 29th, 2016, 1:40 pm

Re: Looking for hardware recommendations

October 26th, 2016, 8:51 am

The biggest performance change when fixing the bug is the number of iterations. Will it be more or less than 20? computation time is linear in the nr of iterations.
 
User avatar
Cuchulainn
Posts: 61542
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Looking for hardware recommendations

October 26th, 2016, 11:12 am

got something working just now (before going to the dentist, but need to go to my client now)

* I'm using float instead of double. I expect double to be twice as slow. I picked float because I think it's interesting, and the example I modifies was in float. I can do double too.
* I'm used 20 iterations of algorithm 3.2b. It didn't converge, there is a bug somewhere I think, the results are wrong too. The number of multiplications / divisions is probably not going to change much when I fix it
*tested it with a low end NVidia GTX 970 with 1664 core

For this case: 
M[ 1.000000, 4.000000, 0.000000 + 50.000000i ] -> 2.99 E9 evalutation  / sec
1. The 101 case was exp(5, 0) = exp(5 + 0i), not exp(0,50). This is because your case explodes in this (it is documented in the article why it explodes). For exp(0,50) only MP works.
2. float is faster but useless for 3.2b. For exp(0,50) even double blows up (MP needed).
3. Can you give running times when N = 10^6,..., 10^9 because I have these at hand myself.
4. I attach my code for the different algos for comparison. (If you have  improvements etc. let mw know).
Attachments
chf.cpp
(2.29 KiB) Downloaded 26 times
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
 
User avatar
Cuchulainn
Posts: 61542
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Looking for hardware recommendations

October 26th, 2016, 11:17 am

M[ 1.000000, 4.000000, 0.000000 + 50.000000i ] -> 2.99 E9 evalutation  / sec
For 4-corei5  I get ~ 5 E6 evaluation for my one second. (with an accuracy of E-8).

Samson (4) versus Goliath (1664)?
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On