19.04.2013 Views

543-pdf

543-pdf

543-pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CPUによる類似度計算の制御<br />

// スケール&誤差を保持するGPU側のメモリ領域<br />

thrust::device_vector< float > derror( img.size( ), 1.0e10f );<br />

thrust::device_vector< float > dscale( img.size( ), 0 );<br />

float s = MIN_SCALE, maxerr = 1.0e10f;<br />

while( s ( thrust::raw_pointer_cast( &derror[ 0 ] ),<br />

thrust::raw_pointer_cast( &dscale[ 0 ] ),<br />

W, H, W - w, H - h, w, h, s, maxerr );<br />

cudaDeviceSynchronize( ); // 処理が完了するまで待機する<br />

// 誤差の最大値を取得する<br />

maxerr = thrust::reduce( derror.begin( ), derror.end( ), 1.0e10f, thrust::minimum< float >( ) );<br />

s *= SCALE_FACTOR; // スケールを変更する<br />

// GPUの処理結果を転送する<br />

...<br />

Trustライブラリを用いてGPUを<br />

活用して誤差の最小値を計算<br />

89

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!