MATLAB PARALLEL COMPUTING TOOLBOX - S Guide de l'utilisateur Page 297

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 656
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 296
Measure and Improve GPU Performance
9-39
repeating the timed operation to get better resolution, executing the function before
measurement to avoid initialization overhead, and subtracting out the overhead of
the timing function. Also, gputimeit ensures that all operations on the GPU have
completed before the final timing.
For example, consider measuring the time taken to compute the lu factorization of a
random matrix A of size N-by-N. You can do this by defining a function that does the lu
factorization and passing the function handle to gputimeit:
A = rand(N,'gpuArray');
fh = @() lu(A);
gputimeit(fh,2); % 2nd arg indicates number of outputs
You can also measure performance with tic and toc. However, to get accurate timing
on the GPU, you must wait for operations to complete before calling toc. There are two
ways to do this. You can call gather on the final GPU output before calling toc: this
forces all computations to complete before the time measurement is taken. Alternately,
you can use the wait function with a GPUDevice object as its input. For example, if you
wanted to measure the time taken to compute the lu factorization of matrix A using tic,
toc, and wait, you can do it as follows:
gd = gpuDevice();
tic();
[l,u] = lu(A);
wait(gd);
tLU = toc();
You can also use the MATLAB profiler to show how computation time is distributed in
your GPU code. Note, that to accomplish timing measurements, the profiler runs each
line of code independently, so it cannot account for overlapping (asynchronous) execution
such as might occur during normal operation. For timing whole algorithms, you should
use tic and toc, or gputimeit, as described above. Also, the profile might not yield
correct results for user-defined MEX functions if they run asynchronously.
Vectorize for Improved GPU Performance
This example shows you how to improve performance by running a function on the GPU
instead of the CPU, and by vectorizing the calculations.
Consider a function that performs fast convolution on the columns of a matrix. Fast
convolution, which is a common operation in signal processing applications, transforms
each column of data from the time domain to the frequency domain, multiplies it by the
Vue de la page 296
1 2 ... 292 293 294 295 296 297 298 299 300 301 302 ... 655 656

Commentaires sur ces manuels

Pas de commentaire

Sony SLT-A65VM Handbücher

Bedienungsanleitungen und Benutzerhandbücher für CD Spieler Sony SLT-A65VM.
Wir stellen PDF-Handbücher Sony SLT-A65VM zum kostenlosen herunterladen nach Dokumenttypen zur Verfügung






Weitere Produkte und Handbücher für CD Spieler Sony

Modelle Dokumententyp
CDX-V58MP Bedienungsanleitung   Sony CDX-V58MP User's Manual, 4 Seiten
D-VJ85 Bedienungsanleitung   Sony D-VJ85 User manual, 36 Seiten
MDX-C8900R Bedienungsanleitung    Sony MDX-C8900R Manual de usuario, 186 Seiten
HDX266/HDX267W Bedienungsanleitung   Sony HDX266/HDX267W User's Manual, 104 Seiten
CDX-M10 Betriebsanleitung       Sony CDX-M10 Operating Instructions, 116 Seiten
MEX-BT2700 Bedienungsanleitung    Sony MEX-BT2700 User's Manual, 56 Seiten
CDP-M555ES Bedienungsanleitung   Sony CDP-M555ES User's Manual, 48 Seiten
CDX-M30 Bedienungsanleitung       Sony CDX-M30 User's Manual, 144 Seiten
D-E660 Bedienungsanleitung   Sony D-E660 User's Manual, 32 Seiten
D-MJ95 Bedienungsanleitung   Sony D-MJ95 User manual, 28 Seiten
D-F21 Bedienungsanleitung   Sony D-F21 User manual, 24 Seiten
D-E561 Bedienungsanleitung   Sony D-E561 User's Manual, 2 Seiten
CDX-434RF Bedienungsanleitung    Sony CDX-434RF User manual, 4 Seiten
CDP-CX335 Bedienungsanleitung    Sony CDP-CX335 User manual, 68 Seiten
D-E551 Bedienungsanleitung   Sony D-E555 User manual, 2 Seiten
CDX-C910 Bedienungsanleitung    Sony CDX-C910 User manual, 62 Seiten
HAR-D1000 Bedienungsanleitung   Sony HAR-D1000 User's Manual, 36 Seiten
CFD-360 Bedienungsanleitung    Sony CFD-360 User manual, 60 Seiten
D-SJ01 Bedienungsanleitung   Sony D-SJ01 User manual, 24 Seiten
CFD-577 Bedienungsanleitung   Sony CFD-577 User manual, 36 Seiten