2

We have some waste FPGA modules (Xilinx), and our own server with PHP. The server is highly loaded sometimes and the PHP scripts especially load the server. We want to try some part of PHP script exec on GPU and FPGA.

What do you think? Is it a sensible way to optimize?

Muc
  • 1,464
  • 2
  • 13
  • 31
user2017083
  • 21
  • 1
  • 2
  • possible duplicate of [Server CPU and GPU With LAMP](http://stackoverflow.com/questions/5637270/server-cpu-and-gpu-with-lamp) – Anigel Aug 01 '13 at 13:35
  • define "highly loaded" please. What certain process does consume what certain resources? – Your Common Sense Aug 01 '13 at 14:20
  • This is interesting. I don't have much experience with php except that of someone who operates a wordpress website. But a quick search up some key bottlenecks that would impact the performance of PHP scripts - – shparekh Aug 07 '13 at 17:52
  • An accelerator may be able to help in - 1. Generating php bytecode from the script. 2. Maintaining a cache of precompiled php generated html pages. There are php accelerators already written which it seems do more of this. I'd love to explore this further if you'd like to. Though I wonder how useful this would be to contemporary webservers. Esp those within a datacenter. – shparekh Aug 07 '13 at 18:05
  • I should mention, that FPGAs may have an edge here over GPUs. I am thinking a FPGA based system with a processor and some accelerators may provide ability to support more connections at lower cost of power and memory. E.g. something that helps to serve up images, maintains a shared cache across multiple servers, etc. This may not be related to your immediate goal but you have gotten creative juices going in me. – shparekh Aug 07 '13 at 18:11
  • This reminds of Intel coprocessors, essentially a gpu labeled as a cpu – ldrrp Sep 16 '16 at 15:28

2 Answers2

2

I'm fairly sure that anything PHP-related is not going to be accelerated by GPU.

And I'm 10x more sure than an FPGA is not the answer to your problems!

If you happen to have some small part of your PHP which is taking up 99% of the time and is very very maths intensive and doesn't require huge amounts of data to process to be transferred to an accelerator, then maybe, just maybe, it's worth considering. But it'll be a big job whatever!

Martin Thompson
  • 16,395
  • 1
  • 38
  • 56
  • I totally agree with Martin. Some (big) companies accelerate SW tasks using FPGAs (or real ASICs), but it is not a "small easy thing" to do, and it is done only when the SW task is well defined and it is math based, or parallel data path manipulation. – YigalB Oct 02 '20 at 07:54
0

It's possible to design a compiler that translates a "purely-functional" subset of PHP to another programming language that can run on a GPU, such as Futhark. I wrote a small proof-of-concept for this compiler, though it's still a work-in-progress.

For instance, a simple higher-order function could be translated to Futhark:

$higher_order_func = function($callback, $value) {
    return $callback($value) * 3.0;
};

A translation of this function might look like this:

let higher-order callback value = 
    (callback value)*3.0

The Futhark compiler can generate CUDA, OpenCL, or sequential C source code, so it can run on either a GPU or CPU.

Anderson Green
  • 30,230
  • 67
  • 195
  • 328