CUDA with MySQL calculus in mysql

Hello to everyone,

I have a GTX 295 that I would like to use to make some calculus with CUDA to see the potentiality helping me in deciding to buy a tesla card…

I have financial data in a Mysql server on Linux and I need to make calculus on this data (I have hundreds of milions of records, so a technology as this could help me a lot…).

I know these languages PHP, Visual Basic, C.

Problem is that I dontt know where to start for compiling an application with CUDA and MySQL. So Im a newbie and I would be grateful to anyone who could help me.

It`s not very clear to me how to connect the application in CUDA to the database… It would be helpful also some guide or book!

Thanks

Since you know C, you should be able to program CUDA after reading the programming guide.

I could see this working if you used some C++ MySQL API Wrapper to interface with the database.

You could write C++ code to run on the host and pull data from the database. Then this data can be copied to the device for parallel processing.

If this doesn’t have to be done on live data, I’d suggest just using PHP to dump the data you need from the database to a file and then using C++ to parse the file and pass the data to the GPU. This would avoid the mess of a C++ MySQL wrapper.

Wonderfull! I don`t have live data! Question: When I dump data with PHP, which kind of file should I use?

I would imagine it wouldn’t really matter much, you just want it to be easy to parse with C++ code

could you give me an example please…

  1. I write the php code and with a query I extract data from the database

  2. From PHP I write this data in a file --> what kind of file would you use?

  3. I write the CUDA code and I make calculus on this data writing the result on a new file

  4. I use again PHP to write the data inside the database

Is this process correct?

Is there some guide for newbie?

I think the ‘best’/most efficient/fastest way to do this would be to write a PHP module in C, then compile it into the PHP that you’re running on your server. This module would call the C/C++ API into mysql to query/retrieve whatever data you needed (could be passed parameters by the PHP script that calls the module), then transfer it to the GPU, launch the kernel, etc.

Use the least amount of PHP possible here…it is generally much slower than C will be. PHP also has a fairly straightforward way of writing the modules, so you really shouldn’t have to deal with too many ‘hacks’. If I were you, I would probably start by writing a ‘test program’ that would link to mysql and do the kernel calling stuff, then once it all works, you can pretty much just copy the code into whatever API is needed to compile the PHP module, then write some sample scripts to test it.

Also, you may need to include some kind of request queuing, since this is only going to be able to handle one request at a time. If you don’t handle concurrent requests (which could occur even on a lightly-used system), PHP is going to issue a ton of error messages to the request that came in second.