function results = hpccBenchmark(gbPerWorker)
%HPCCBENCHMARK runs the HPC Challenge benchmark on the workers
% in the current parallel pool.

% Obtain the current parallel pool.
pool = gcp;

% Compute sizes for each test, depending on the number of workers and
% and the permitted memory per worker.
dataSizes = hpccDataSizes(pool.NumWorkers, gbPerWorker);

% Run the HPC Challenge.
hplResult = hpccHPL(dataSizes.HPL);
dgemmResult = hpccDGEMM(dataSizes.DGEMM);
streamResult = hpccSTREAM(dataSizes.STREAM);
ptransResult = hpccPTRANS(dataSizes.PTRANS);
randomAccessResult = hpccRandomAccess(dataSizes.RandomAccess);
fftResult = hpccFFT(dataSizes.FFT);

% Compile the results.
results = [hplResult; dgemmResult; streamResult; ...
              ptransResult; randomAccessResult; fftResult];

end

