MATLAB Answers

Trying to use gpuArray for graph function

17 ビュー (過去 30 日間)
Chad Davies
Chad Davies 2020 年 5 月 18 日
コメント済み: Chad Davies 2020 年 5 月 19 日
Hi,
We are trying to use gpuArray's to speed up our graph function call but after converting 's' and 't' to gpuArray's the graph function has an error which we have been unable to move past.
The code, error and code output are below. Both gpuArray's are 28 rows with no zero's or negative numbers.
Any help is greatly appreciated.
Thanks
Code:
fprintf('t:')
t = gpuArray((table2array(edgedefs(:,5))))
class (t)
%t = gpuArray(t);
s = gpuArray((table2array(edgedefs(:,4))))
class(s)
%s = gpuArray(s)
w = table2array(edgedefs(:,3));
fprintf('Before Graph\n\n')
beforegraph = clock
G = graph(s, t)
Error message:
Error using matlab.internal.graph.MLGraph
Source must be a numeric array of positive integer node indices.
Error in matlab.internal.graph.constructFromEdgeList (line 218)
G = underlyingCtor(s, t, totalNodes);
Error in graph (line 300)
matlab.internal.graph.constructFromEdgeList(...
Error in a_2020_05_15_Sc (line 145)
G = graph(s, t)
Output:
>> t:
t =
398894
398895
398896
398897
398899
398900
398901
398902
398903
398904
398905
398906
398907
398908
398909
398910
398911
398912
398913
398914
398915
398916
398917
398918
398919
398920
398921
398922
ans =
'gpuArray'
s =
7754
7755
7756
7757
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
ans =
'gpuArray'
Before Graph
beforegraph =
2020 5 17 20 39 4.14

  0 件のコメント

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

回答 (1 件)

Edric Ellis
Edric Ellis 2020 年 5 月 18 日
Unfortunately, graph does not support using gpuArray data in this way. Is there some specific algorithm on your graph that you're looking to speed up using the GPU?

  1 件のコメント

Chad Davies
Chad Davies 2020 年 5 月 19 日
Hi Edric,
Thanks for the info.
These are the three commands that I'm using to display the data. I have about 1 million nodes to plot in my test case. When we process the real data, there will be 1 billion nodes.
The graph and plot functions below execute very quickly, but the layout function takes 6-8 hours. Is there a faster way to run the layout fuction?
G = graph(s, t)
figure;
H = plot(G,'MarkerSize',4)
layout(H,'force3','UseGravity',true,'Iterations',50, 'WeightEffect', 'inverse')
Thank for any help that you can provide.

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by