|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: OPR Programming Challenge
I wonder would happen if you wrote that in C and compiled it to a callable routine.
|
|
#2
|
|||
|
|||
|
Re: OPR Programming Challenge
I've been a bit busy, but since the light is at the end of the tunnel, I met with Jim, a mathematician on our team to see if he would do this with our sparse matrix tools. The first screenshot shows the breakdown of times. The second is the code written in LV.
He is going to tinker to see if he can find a better way to build the sparse matrix, since most of the time is spent before invoking the solver. This was timed on a Windows VM that has 4 cores running on my macbook 2.7GHz core i7. Jim was running on a desktop machine which I don't have details for, and he wasn't writing the file. His was somewhat faster. My cores are only about 70% utilized since most of the time isn't spent in the solver. Greg McKaskle |
|
#3
|
||||
|
||||
|
Re: OPR Programming Challenge
OK guys. I just wrote, compiled, and ran a 32-bit single-core native app on an 8-year-old Pentium D machine running 32-bit XP Pro SP3, and timed it using RDTSC instructions embedded in the code. It took 11.9 milliseconds to read the raw data file (cached in RAM) and generate the alliance score vectors and the sparse design matrix. Using 16-bit unsigned integers for the team numbers and scores, generating the sparse matrix directly from the raw data, and compiling to native code saves a lot of runtime. Last edited by Ether : 15-12-2014 at 17:46. Reason: add detail |
|
#4
|
||||
|
||||
|
Re: OPR Programming Challenge
Here's the Delphi code. I wonder how fast it would run on a modern 64-bit machine. Maybe somebody would like to port it to C and try it.
|
|
#5
|
||||
|
||||
|
Re: OPR Programming Challenge
Quote:
See this post for some additional details: http://www.chiefdelphi.com/forums/sh...00#post1404300 |
|
#6
|
|||
|
|||
|
Re: OPR Programming Challenge
Less busy now, so I met with Jim a few we made a few more passes. The attached image shows the top level LV diagram. And the zip has the code saved in LV 2014. The other image shows the time breakdown for the different portions.
The code runs in around 20ms on my laptop running a VM. It iterates until the residual is about 3 digits after the decimal. Building the sparse matrix creates the diagonal terms and upper portion independently, which substantially speeds the elimination of duplicate terms. The complete solver was swapped out for one based on conjugate gradient. The commented code loads from disk, the enabled code has the data in RAM, in a constant. Loading from disk adds another 20ms. Greg McKaskle |
|
#7
|
||||
|
||||
|
Re: OPR Programming Challenge
Quote:
Quote:
|
|
#8
|
|||
|
|||
|
Re: OPR Programming Challenge
The initial guess is the zero vector. It takes 11 iterations to converge.
Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|