Sie verfolgen jetzt diese Frage
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
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 Kommentare

Akzeptierte Antwort

37 Kommentare
figure


- 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Es ist ein Fehler aufgetreten
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)
Asien-Pazifik
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)

