是的,您可以并行化,这是使用 HPCC 的要点。不阅读您的代码很难回答。我假设您的代码类似于:
EXPORT CalculateDistances :=FUNCTION(parameters)
// For each parameter do your DNA magic(matrix calculation)
RETURN something;
END;
result:= CalculateDistances(A,B,C,D...);
OUTPUT(result, named('result'));
您可以使用PARALLEL ECL 命令并在 Thor(而不是 HThor)中运行 workunit ,将函数编码与基本矩阵计算并行化。
EXPORT CalculateDistance :=FUNCTION(Matrix1, Matrix2)
// Your DNA magic(basic matrix calculation) for Matrix1&Matrix2
RETURN something;
END;
result01:= CalculateDistance(A,B);
result02:= CalculateDistance(A,C);
result03:= CalculateDistance(A,D);
result04:= CalculateDistance(B,A);
result05:= CalculateDistance(B,C);
result06:= CalculateDistance(B,D);
result07:= CalculateDistance(C,A);
result08:= CalculateDistance(C,B);
result09:= CalculateDistance(C,D);
result10:= CalculateDistance(D,A);
result11:= CalculateDistance(D,B);
result12:= CalculateDistance(D,C);
executeCalculates := PARALLEL(
result01,
result02,
result03,
result04,
result05,
result06,
result07,
result08,
result09,
result10,
result11,
result12
);
executeCalculates;