function out = hpccFFT(m)
%hpccFFT HPCC FFT Benchmark computation
%   hpccFFT(m) computes the FFT of a complex random vector of length m.

% Copyright 2018 The MathWorks, Inc.

if nargin < 1
    sz = hpccDataSizes();
    m  = sz.FFT;
end

dataSizeBytes = 16 * m;
hpccBenchmarkStarting("FFT", dataSizeBytes);

spmd
    v = complex(codistributed.rand(m, 1), ...
                codistributed.rand(m, 1));
    tic
    fft(v);
    t = toc;
end

tmax = max([t{:}]);
perf = 1e-9 * (5 * m * log(m) / log(2)) / tmax;
out  = hpccBenchmarkEnd("FFT", dataSizeBytes, tmax, perf, "GFlops");
end

