tag:blogger.com,1999:blog-43995194134183265652024-03-14T11:21:28.820-07:00GPU Programming Final ProjectUnknownnoreply@blogger.comBlogger13125tag:blogger.com,1999:blog-4399519413418326565.post-17436456486223344712011-12-19T18:41:00.000-08:002011-12-19T18:41:43.279-08:00The year endsThe semester has come to an end.<br />
<br />
So here is my video:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dy2nHva4FM8qrNRA9G3pOdh31mzsN44g75lbk7IFJRWlUTNYD2Xq_9Gciv9_ss9bkYY5pwQUFVzP6ILQO7hzQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
I am satisfied with what I accomplished and I got a lot more familiar with choosing number of threads and debugging CUDA.<br />
<br />
There are a few things I would like to do once I get a good computer like:<br />
<br />
- Get the velocity advection in the GPU<br />
- Get the whole simulation in the GPU so there is no data going back and forth between the CPU and GPU<br />
- Make it look good (i.e. better renderer)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-16332653257228895662011-12-17T16:14:00.000-08:002011-12-17T16:14:26.096-08:00Progress!!So, I finally got the density advection to work in the GPU. Time to try to get the velocity advection in as well.<br />
<br />
I gave up on 3D blocks and set for a 1D block and just figuring out the 3D indexing from it. This works much better when there are more than 1 block.<br />
Also, I found out that a lot of my problems consisted on using more resources than what I had. So, everybody, error checking is GOOD. On the bright side, I was right about needing more registers when I first saw those weird things happening, so go me!<br />
<br />
Here is a 5x5x5 grid running with the density advection (I have run this on 100x50x50 grids and it works but forgot to get a screenshot and it would just take too much time to do it again).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirkvDaZ3VQpD0McKK2y3oZEt00Ad1VojQYuL9GHRkitAGcHEggyf3SrYwcMpdPlKwoabseJpaY56lRoZpZhmzY28khVwhAdqCtXDtNMedkh8rNtK8xeNnD7OBx-4romPO_mNt9ABbYwpXj/s1600/5_5_5_DensityGPU.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="239" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirkvDaZ3VQpD0McKK2y3oZEt00Ad1VojQYuL9GHRkitAGcHEggyf3SrYwcMpdPlKwoabseJpaY56lRoZpZhmzY28khVwhAdqCtXDtNMedkh8rNtK8xeNnD7OBx-4romPO_mNt9ABbYwpXj/s320/5_5_5_DensityGPU.PNG" width="320" /></a></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-77202000064275607982011-12-16T13:34:00.001-08:002011-12-16T13:38:37.719-08:00More issues but with size of blocksSo, indexing issues are not present anymore, sort of.<br />
<br />
Now, it is something that I feel I need to understand CUDA and the GPU more than I do currently to figure it out.<br />
<br />
Here is the deal.<br />
I have a 1D array of size 150 corresponding to a grid of size 6x5x5. So, in my kernel, the block size is dim3(6,5,5). I am only trying to write 10.0f in every spot in the array. In this case, all the numbers are random floats.<br />
<br />
If instead I have dim3(6,5,4), it writes 10.0f to the corresponding spots.<br />
<br />
Why is this? The number of threads is not even greater than 512, so I don't understand why this is happening.<br />
<br />
Any suggestion is appreciated, especially since Google has just failed me.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-72701396695306107082011-12-07T12:04:00.001-08:002011-12-07T12:05:21.587-08:00Gone for the week<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">I am still trying to get the density to work in the GPU. At least I fixed the indexing problem.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">This will be the only update for the week because I am going away until mid next week.</span><br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-257207729478593552011-12-02T15:34:00.001-08:002011-12-02T15:41:15.123-08:00Updates<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
This week I decided to put off on trying to make CG faster.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Instead, I am starting to put other parts of the simulation into the GPU.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
I started by trying to get velocity advection to work but later switched gears to getting density advection to work. It seemed to me like a good thing to do because it involves less functions where things can go wrong. If it works I can be sure that the common functions to all advections are working, so if the other advections don't work, then I already have a bunch of possible places for error ruled out.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
But I have no further developments in this area. I am slowly checking that I haven't missed any details in the implementation of the functions in the GPU also checking the accessing of the data and such.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Let's see how this goes this weekend.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-59057429400670414492011-11-25T07:34:00.001-08:002011-11-25T08:42:19.616-08:00So Slow<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
I still haven't managed to make it run any faster. It might be as fast as it is going to get with cublas and cusparse, in which case it means I need to find better libraries (I am convinced writing it all myself is not going to be any faster, plus people have already dealt with these problems, so I shouldn't need to reinvent the wheel, but suggestions are welcome).</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
The slow down is considerable:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
For a 10x10x10 grid, the GPU takes around 33ms in total (~7 in the analysis phase, ~24ms in total for the iterations, ~2ms doing other things).</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
For the same grid, the CPU does it in 7ms (no anlaysis phase, ~5ms in total for the iterations, ~2ms doing other things).</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
And the GPU just takes longer and longer time as the grid fills up, with as much as 60ms being spent (I didn't wait more to get higher numbers).</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
I was looking into a library, CUSP, but I couldn't get it to compile with my project, so if there are any CUSP users, please let me know how to do that =)</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
And that is it for now.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-21034163112195537252011-11-20T14:42:00.001-08:002011-11-20T14:52:00.642-08:00Timing<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
So I timed the different parts of the simulation both in the CPU and GPU. This is what I found.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEindRR1hBZMaqq-_ZRkJwmL6dzg4nt51Az-rF5_YLVULxycq7ExMiijrHPFUNI9IF6aTDSLB_yWE9A48FTzPbst4wPaZMVps8Sqzj5Nv0tw1TtzC_a4GNHPrxhQa6MR68Wk5vG84O5C25EO/s1600/TableTimings.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEindRR1hBZMaqq-_ZRkJwmL6dzg4nt51Az-rF5_YLVULxycq7ExMiijrHPFUNI9IF6aTDSLB_yWE9A48FTzPbst4wPaZMVps8Sqzj5Nv0tw1TtzC_a4GNHPrxhQa6MR68Wk5vG84O5C25EO/s640/TableTimings.PNG" width="640" /></a></div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg35vxWC4D5dCnVDAapULSHcDm6Yk0t4O9-YlLvvI96XpJDHTOjkjsJi20_Ze7d_f15TznZabQQEYL4j7OjdRCGeErtQDZw4keoVNP8Ns6jwZANOdg9qgyKw_nY-GcIJrQRiC5swUYoej_7/s1600/GraphTimings.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg35vxWC4D5dCnVDAapULSHcDm6Yk0t4O9-YlLvvI96XpJDHTOjkjsJi20_Ze7d_f15TznZabQQEYL4j7OjdRCGeErtQDZw4keoVNP8Ns6jwZANOdg9qgyKw_nY-GcIJrQRiC5swUYoej_7/s400/GraphTimings.PNG" width="400" /></a></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
The y-axis is the amount of milliseconds (Excel doesn't like me much).</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Two things are worth noting:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
1. The GPU project function (this is where the CG is done) is a lot slower in the GPU.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
2. Advecting velocities is very slow as well, which makes for a good candidate to be moved to the GPU.</div>
<table border="0" cellpadding="0" cellspacing="0" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; width: 651px;"><tbody>
<tr height="20" style="height: 15.0pt;"><td class="xl63" height="20" style="height: 15.0pt; width: 104pt;" width="139"><br /></td><td class="xl66" style="width: 48pt;" width="64"><br /></td><td class="xl66" style="border-left: none; width: 48pt;" width="64"><br /></td><td class="xl66" style="border-left: none; width: 48pt;" width="64"><br /></td><td class="xl66" style="border-left: none; width: 48pt;" width="64"><br /></td><td class="xl66" style="border-left: none; width: 48pt;" width="64"><br /></td><td class="xl66" style="border-left: none; width: 48pt;" width="64"><br /></td><td class="xl66" style="border-left: none; width: 48pt;" width="64"><br /></td><td class="xl66" style="border-left: none; width: 48pt;" width="64"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl64" height="20" style="height: 15.0pt;"><br /></td><td class="xl66" style="border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl64" height="20" style="height: 15.0pt;"><br /></td><td class="xl66" style="border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl65" height="20" style="height: 15.0pt;"><br /></td><td class="xl66" style="border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td><td class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl66" height="20" style="border-top: none; height: 15.0pt;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl66" height="20" style="border-top: none; height: 15.0pt;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl66" height="20" style="border-top: none; height: 15.0pt;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl66" height="20" style="border-top: none; height: 15.0pt;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl66" height="20" style="border-top: none; height: 15.0pt;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td></tr>
<tr height="20" style="height: 15.0pt;"><td class="xl66" height="20" style="border-top: none; height: 15.0pt;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: none; border-top: none;"><br /></td><td align="right" class="xl66" style="border-left: medium none; border-top: medium none;"><br /></td><td align="right" class="xl66" style="border-left: medium none; border-top: medium none;"><br /></td><td align="right" class="xl66" style="border-left: medium none; border-top: medium none;"><br /></td>
</tr>
</tbody></table>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-80546203039329254862011-11-19T13:13:00.001-08:002011-11-20T13:39:14.662-08:00GPU Time!<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">I finally got it all down in the GPU, back, and rendering!</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">I also got it work for 2D as well as 3D grids.</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">Here is a graph of current frame rate in frames per second (y axis) vs. size of the grid (x-axis). The CPU is way faster than the GPU which means it is time for a lot of optimizations to be done or use a new approach (or both).</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCDLADCrz33YnVyR9dfj3yFtQtoqxqv8RhH19OUyFvGiqQIJxn1Tgc4V1hqsdW5GREmpm6cdVtCWyJ_wJsT_Gwxz75CTWSDjc6AIVDPk-Qb4feYmTzmLc1UWPfVl2YaVC_mV_q6fXWiklW/s1600/graph01_v2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCDLADCrz33YnVyR9dfj3yFtQtoqxqv8RhH19OUyFvGiqQIJxn1Tgc4V1hqsdW5GREmpm6cdVtCWyJ_wJsT_Gwxz75CTWSDjc6AIVDPk-Qb4feYmTzmLc1UWPfVl2YaVC_mV_q6fXWiklW/s400/graph01_v2.PNG" width="400" /></a></div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
<span style="font-size: small;"></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">But having everything finally working in the GPU is a good thing.</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">And here is a screen shot of smoking in the GPU.</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
<span style="font-size: small;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZKPtbTy4M5PKgEBlrQprJvWgxQvHQHMgDWi-aB2k8DV8pxEmdf2vhxRNdA-rtU6iFEWPkj-_FK1HviYAjda4_KeaDH10MP4e3opgjzztH4Rm4JMppseWzX3mDD7BomOhtTYbdtDNEgYdA/s1600/smoke_0032.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZKPtbTy4M5PKgEBlrQprJvWgxQvHQHMgDWi-aB2k8DV8pxEmdf2vhxRNdA-rtU6iFEWPkj-_FK1HviYAjda4_KeaDH10MP4e3opgjzztH4Rm4JMppseWzX3mDD7BomOhtTYbdtDNEgYdA/s320/smoke_0032.png" width="320" /></a></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; font-size: small;">I am going to make a movie later and post it.</span><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Plans for the week:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br />
-CHANGE THE COLOR OF THE SMOKE</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
-Make improvisations on the GPU code</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
-Make movies for large grids (I am sorry computers)</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-78654832982966164332011-11-11T17:21:00.001-08:002011-11-11T17:42:57.189-08:00Presentation, presentation, presentation<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">Who would have said that working on a presentation would mean so much time invested?</span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">My presentation is (apparently) going to be on Conjugate Gradient on the GPU.</span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">My references are:</span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;">For an introduction to the Conjugate Gradient Method: </span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><a href="http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CDgQFjAD&url=http%3A%2F%2Fciteseer.ist.psu.edu%2Fviewdoc%2Fdownload%3Bjsessionid%3DE5DB07565443900ABE46BC880A821FD0%3Fdoi%3D10.1.1.110.418%26rep%3Drep1%26type%3Dpdf&ei=qW24Tq24GaKC2wWTztHMDQ&usg=AFQjCNFw97_l7sEENZ3-XvdRqLvfdLo18g"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">An Introduction to the Conjugate Gradient Method Without the Agonizing Pain</span></a></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"> </span><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"> </span><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"></span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">For more in depth GPU CG:</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span style="background-color: transparent; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;"></span><a href="http://www.cs.columbia.edu/cg/pdfs/28_GPUSim.pdf"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Sparse Matrix Solvers on the GPU: Conjugate Gradients and Multigrid</span></a></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><a href="http://www2.engr.arizona.edu/%7Eece569a/Readings/project/presentations/pennybacker_hpc.pdf" id="internal-source-marker_0.723387482871361"><span style="background-color: transparent; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;"></span></a><a href="http://www2.engr.arizona.edu/%7Eece569a/Readings/project/presentations/pennybacker_hpc.pdf"><span style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Accelerating the Conjugate Gradient Method with CUDA</span><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"> </span></a></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">For Samples on CG with Cuda (CUBLAS, cuSPARCE):</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><a href="http://developer.nvidia.com/cuda-libraries-sdk-code-samples#conjugateGradient"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">CG</span></a></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"><a href="http://developer.nvidia.com/cuda-libraries-sdk-code-samples#conjugateGradientPrecond">Preconditioned CG</a></span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">For fluids simulation:</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"></span><a href="http://http.developer.nvidia.com/GPUGems/gpugems_ch38.html" id="internal-source-marker_0.723387482871361"><span style="background-color: transparent; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;"></span></a><a href="http://http.developer.nvidia.com/GPUGems/gpugems_ch38.html"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Chapter 38. Fast Fluid Dynamics Simulation on the GPU</span></a></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">And I was going to read more about fluids simulation on the GPU but decided it was time to update my blog.</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">So what have I learnt?</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">- The samples from CUDA are helpful to understand CG behind the scenes. Unfortunately, they aren't optimized (to make code clearer to understand) but I think I should be able to use them as a starting point.</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">- In CH 38, the code was implemented in the fragment shaders using Cg. They also moved every step to the GPU (i.e. advection, diffusion, etc).</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">- The dominating operations for CG is the matrix-vector multiplication. So this is where the most of the optimizations should be centered. </span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"><br /></span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">This has given me a good idea what to read next, if not for the presentation, for the implementation of the CG solver later on, after ditchinig CUBLAS and cuSPARCE. Hopefully, one day I'll be done with the reading and get on with the code.</span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"><br /></span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">I have also started playing around with the code. I think I now understand how the A matrix is built in the framework so that I can translate it to the data structures asked for in the methods used from the libraries to implement the CG solver. What is holding me back is a crash when I try to print out... My guess: some memory leak or plain bad luck. </span></span></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Next steps:</span></span></div>
<ul style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<li><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Finish the presentation (which means start the presentation in PowerPoint)</span></span></li>
<li><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Find out why the code is breaking.</span></span></li>
<li><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Tackle the feedback received from the checkpoint presentation </span></span><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">(probably for the final video)</span></span><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">:</span></span></li>
<ul>
<li><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Get running times (FPS in current implementation in the CPU)</span></span></li>
<li><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Try larger grids; report sizes and FPS </span></span></li>
<li><span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Explain the A-Matrix better and the semi lagrangian method </span></span></li>
</ul>
</ul>
<div style="color: #f3f3f3; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-size: small;"><span id="internal-source-marker_0.723387482871361" style="background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"></span></span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-77107322460508441792011-11-06T18:57:00.001-08:002011-11-06T18:57:22.894-08:00Alpha Presentation Video<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/CFTaQt-fVVo?feature=player_embedded' frameborder='0'></iframe></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-58855402894645094402011-11-04T08:35:00.001-07:002011-11-04T08:35:52.946-07:00<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">And I finally got the framework! So now I have to make it work =) So no real updates yet, possibly by Monday.</span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-68955630987563298532011-10-18T11:20:00.000-07:002011-10-18T11:20:43.834-07:00Smoke Simulation in the GPU - Pitch<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Zoom>0</w:Zoom>
<w:TrackMoves>false</w:TrackMoves>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:DrawingGridHorizontalSpacing>18 pt</w:DrawingGridHorizontalSpacing>
<w:DrawingGridVerticalSpacing>18 pt</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>0</w:DisplayVerticalDrawingGridEvery>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:DontGrowAutofit/>
<w:DontAutofitConstrainedTables/>
<w:DontVertAlignInTxbx/>
</w:Compatibility>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="276">
</w:LatentStyles>
</xml><![endif]-->
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div class="MsoNormal">
<span class="Apple-style-span" style="font-family: Tahoma;">Smoke Simulation in the CPU
is very slow and not suited for real time projects, even in small grids. Each
frame takes many seconds to render, depending on the size of the grid, and the
most realistic simulations usually require bigger grids than 10 X 1 cells. I would
like to make it more efficient by using the GPU to implement costly
calculations that slow down the simulation and be able to simulate smoke in
bigger grids. I will also use this time to get a good-looking rendering of
smoke.</span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Tahoma;">The first step would be to
move the conjugate gradient solver to the GPU, since this is the slowest step
in the simulation. After that I could focus on either improving the looks by
implementing <a href="https://mmack.wordpress.com/">blackbody rendering</a> and/or
continue taking more steps into the GPU to increase performance further.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Tahoma;">Previous work on fluid
simulation on the GPU:<o:p></o:p></span></div>
<div class="MsoNormal">
<a href="http://http.developer.nvidia.com/GPUGems/gpugems_ch38.html"><span style="font-family: Tahoma;">http://http.developer.nvidia.com/GPUGems/gpugems_ch38.html</span></a><span style="font-family: Tahoma;"><o:p></o:p></span></div>
<div class="MsoNormal">
<a href="http://www.cs.columbia.edu/cg/pdfs/28_GPUSim.pdf"><span style="font-family: Tahoma;">http://www.cs.columbia.edu/cg/pdfs/28_GPUSim.pdf</span></a><span style="font-family: Tahoma;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span class="Apple-style-span" style="font-family: Tahoma;"><br /></span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4399519413418326565.post-74895840319297103592011-10-06T15:40:00.001-07:002011-10-06T15:40:50.863-07:00<span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">First post for my final project in GPU programming. I still haven't made up my mind what my project is so I am using a generic title and URL =D</span>Unknownnoreply@blogger.com0