私はOpenCLをかなり新しくしており、標準的なCPU実装と比較して異なるGPUでその性能を比較するDSPアルゴリズム を実装しようとしています。 私は巨大なパフォーマンスの向上を達成しましたが、奇妙なのは、はるかに高速なGTX 480とほぼ同じゲインをGT240で得ることです。私のプログラムは2つのカーネルを実行し、GTX 480ではスピードアップしながら遅くなる。OpenCLカーネルは、より高速のGPUでより遅く実行する
GT240:カーネル1:226us、カーネル2:103us。
GTX 480:カーネル1:35us、カーネル2:293us。
これらの数値は、Visual Profilerを使用して取得したものです。 以下は、カーネル2のコードです。これは、より大きなカードでは、ほぼ3倍遅くなります。このカーネルは、iTotalBins x iNumAnglesが大きいメモリブロックをとり、iNumAnglesの各行の最大値を計算し、隣接する3つの値に曲線を当てはめます。
__kernel void max_curve_fit_gpu (__global float* fCorrelationResult,
const int iNumAngles,
const int iTotalBins,
__global float* fResult){
// Get the thread ID which is used as the index the bin the direction is being calculated for
const int iBinNum = get_global_id(0);
const int iOffset = iBinNum*iNumAngles;
// Find the max for this bin
float fMax = 0;
int iMaxIndex = 0;
for (int iAngle=0; iAngle<iNumAngles; iAngle++)
{
if (fMax < fCorrelationResult[iOffset + iAngle])
{
fMax = fCorrelationResult[iOffset + iAngle];
iMaxIndex = iAngle;
}
}
// Do the curve fit
float fPrev, fNext, fA, fB, fAxis;
fPrev = fCorrelationResult[iOffset + (iMaxIndex + iNumAngles - 1) % iNumAngles];
fNext = fCorrelationResult[iOffset + (iMaxIndex + iNumAngles + 1) % iNumAngles];
fB = (fPrev - fNext)*0.5f;
fA = (fNext + fPrev) - fMax*2.0f;
fAxis = fB/fA;
// Store the result
fResult[iBinNum] = iMaxIndex + fAxis; }
のVisual Profilerはまた、私はのif-elseなステートメントを使用していない最大の検索のバージョンを使用しているカーネルの2の135パーセントのグローバルメモリ命令のリプレイがあることを示しているが、それは、両方のGPUの上でも、実行速度が遅いです。
ご協力いただきますようお願い申し上げます。