コンピューティングにおいて、Brookプログラミング言語とその実装であるBrookGPUは、グラフィックス処理ユニット(GPGPU)上で汎用コンピューティングを可能にするための初期の影響力のある試みでした。 [ 1 ] [ 2 ]スタンフォード大学のグラフィックスグループで開発されたBrookは、 ATIやNvidiaなどのGPUの並列性を活用するように設計されたストリームプログラミング言語のコンパイラおよびランタイムシステムでした。
BrookGPUは、 ANSI Cの派生言語であるBrookストリームプログラミング言語で記述されたプログラムをコンパイルします。計算バックエンドとしてOpenGL v1.3以降、DirectX v9以降、またはAMDのClose to Metalをターゲットにすることができ、 Microsoft WindowsとLinuxの両方で動作しました。デバッグ時には、 CPU上で仮想グラフィックカードをシミュレートすることもできました。
最後の主要なベータ版リリース(v0.4)は2004年10月でしたが、その後開発が再開され、2007年11月にv0.5ベータ1がリリースされた時点で再び開発は停止しました。
v0.5の新機能には、大幅にアップグレードされ高速化されたOpenGLバックエンドが含まれています。これは、PBuffersの代わりにframebufferオブジェクトを使用し、独自のベンダー拡張機能を使用する代わりに、標準のOpenGLインターフェースに合わせてコードを統一しています。GLSLのサポートが追加され、これまでDirectX 9でのみサポートされていたすべての機能(複雑な分岐やループなど)がOpenGLで利用できるようになりました。特に、これによりBrookはLinuxでもWindowsと同等の機能を発揮できるようになりました。
v0.5シリーズのその他の改善点としては、マルチバックエンドの使用が挙げられます。これにより、異なるスレッドが異なるBrookプログラムを同時に実行できるようになり(マルチGPU構成の利用を最大限に活用できます)、 CPUバックエンドではSSEとOpenMPがサポートされます(これにより、最新のCPUをほぼ最大限に活用できます)。
デスクトップCPUとGPGPUを同等に比較することは、アルゴリズムと構造の違いにより問題がある。[ 3 ]
For example, a 2.66 GHz Intel Core 2 Duo can perform a maximum of 25 GFLOPs (25 billion single-precision floating-point operations per second) if optimally using SSE and streaming memory access so the prefetcher works perfectly. However, traditionally (due to shader program length limits) most GPGPU kernels tend to perform relatively small amounts of work on large amounts of data in parallel, so the big problem with directly executing GPGPU algorithms on desktop CPUs is vastly lower memory bandwidth as generally speaking the CPU spends most of its time waiting on RAM. As an example, dual-channel PC2-6400 DDR2 RAM can throughput about 11 Gbit/s which is around 1.5 GFLOPs maximum given that there is a total of 3 GFLOPs total bandwidth and one must both read and write. As a result, if memory bandwidth constrained, Brook's CPU backend won't exceed 2 GFLOPs. In practice, it's even lower than that most especially for anything other than float4 which is the only data type which can be SSE accelerated.
On an ATI HD 2900 XT (740 MHz core 1000 MHz memory), Brook can perform a maximum of 410 GFLOPs via its DirectX 9 backend.[4] OpenGL is currently (due to driver and Cg compiler limitations) much less efficient as a GPGPU backend on that GPU, so Brook can only manage 210 GFLOPs when using OpenGL on that GPU. On paper, this looks like around twenty times faster than the CPU, but as just explained it isn't as easy as that. GPUs currently have major branch and read/write access penalties so expect a reasonable maximum of one third of the peak maximum in real world code - this still leaves that ATI card at around 125 GFLOPs some five times faster than the Intel Core 2 Duo.
However this discounts the important part of transferring the data to be processed to and from the GPU. With a PCI Express 1.0 x8 interface, the memory of an ATI HD 2900 XT can be written to at about 730 Mbit/s and read from at about 311 Mbit/s which is significantly slower than normal PC memory. For large datasets, this can greatly diminish the speed increase of using a GPU over a well-tuned CPU implementation. Of course, as GPUs become faster far more quickly than CPUs and the PCI Express interface improves, it will make more sense to offload large processing to GPUs.
{{citation}}: CS1メンテナンス: 日付と年 (リンク)