Displaying a struct containing gpuArray fields takes an extremely long time in R2024b

I find that when I create a struct (or object) whose fields are large gpuArrays, it takes an extremely long time (1-2 minutes) to display the struct at the command line. Example:
>> c.data=gpuArray.rand(266,354,894,'single');
>> tic; c, toc
c =
struct with fields:
data: [266×354×894 gpuArray]
Elapsed time is 100.266106 seconds.
I have observed this in R2024b on two platforms,
(1) Windows 10; NVIDIA GeForce RTX 4080 SUPER
(2) Windows 11; NVIDIA RTX 5000 Ada Generation
Does anyone know why this might be happening?

1 件のコメント

Matt J
Matt J 2025 年 1 月 14 日
編集済み: Matt J 2025 年 1 月 14 日
Also, it doesn't seem to happen in R2024a, so I'm guessing R2024b introduced this problem.

サインインしてコメントする。

 採用された回答

Edric Ellis
Edric Ellis 2025 年 1 月 15 日

0 投票

Thanks for reporting this, I can reproduce the problem here (though not so severely). For now I'm afraid the only workaround is "don't do that".

1 件のコメント

Matt J
Matt J 2025 年 1 月 15 日
Thanks @Edric Ellis. Do you think it's a problem that would eventually be solved with a patch download, rather than upgrading to a new Matlab version?

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2025 年 1 月 16 日
Here's a possible workaround:
c.a=1; c.b=2; c.data=gpuArray.rand(100,100,100,'double');
tic; c, toc
c =
struct with fields:
a: 1
b: 2
data: [100×100×100 gpuArray]
Elapsed time is 0.170750 seconds.
tic; shellClass.gather(c), toc
ans =
struct with fields:
a: 1
b: 2
data: [100×100×100 gpu_double]
Elapsed time is 0.000875 seconds.

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

リリース

R2024b

質問済み:

2025 年 1 月 14 日

編集済み:

2025 年 1 月 16 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by