Vous suivez désormais cette question
- Les mises à jour seront visibles dans votre flux de contenu suivi.
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails.
Matrix and vector multiplication of size using a CPU is very slow. Using GPU is much quicker but I need a way around the size limitation.


10 commentaires

Réponse acceptée

37 commentaires





- load('debug.mat') this loads the debug file and AA; AB; rhs; U0 & U1
- surf(abs(AA),'EdgeColor','none') provides graph of tri diagonal matrix as before.
- surf(abs(AB),'EdgeColor','none') provides graph of matrix as before.
- plot(abs(U0)) provides graph of matrix as before.
- plot(abs(rhs)) provides graph of matrix as before.
- issparse(AA) logical 1 (yes), it does not say this in workspace, just gpuArray.
- issparse(AB) logical 1 (yes), it does not say this in workspace, just gpuArray.
- sol = AA\rhs; this failed in the program for U1.
- plot(abs(sol)) produces non NaN and shows a graph of a slightly moved soliton as required.
- isgpuarray(sol) logical 1 (yes),




Do make sure you move the result of backslash back to the GPU so that subsequent operations take place on the GPU. So use gpuArray(gather(AA)\gather(rhs)) rather than just gather(AA)\gather(rhs), to ensure U1 is still a gpuArray on output.
As a developer of the gpuArray datatype, I'm usually - not always, but usually! - pretty confident in my assertions about its behaviour. Whatever you're seeing in the task manager is heavily confused by the fact that MATLAB's GPU functionality pools memory and operates lazily and asynchronously. That means the GPU isn't always being used when a line of code is run, it doesn't always finish when the next line of code is run, and memory no longer assigned to a variable is not necessarily released back to the system to show up as free in the Task Manager. Hopefully we will soon have our own monitor apps so you can more easily see this behaviour in MATLAB.
Worth reminding you perhaps that gather(AA) does not move AA to the CPU, it creates a temporary variable on the CPU and copies AA there. So the GPU memory is not released.
I'm glad you've found some compromises about where to do CPU work and where GPU. It takes quite a lot of memory to move a sparse CPU array to the GPU because a conversion between two different storage formats is required (CSC to CSR, if you care). It's usually best to create the data on the GPU from the outset, for instance by passing gpuArray data to spdiags.
Plus de réponses (0)
Voir également
Catégories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Une erreur s'est produite
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asie-Pacifique
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)