-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDelphiMatrixBenchmark.dpr
More file actions
74 lines (66 loc) · 1.44 KB
/
DelphiMatrixBenchmark.dpr
File metadata and controls
74 lines (66 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
program DelphiMatrixBenchmark;
uses
Vcl.Forms,
Vcl.Themes,
Vcl.Styles,
Form in 'Form.pas',
Config in 'Benchmark\Config.pas',
Result in 'Benchmark\Result.pas',
Runner in 'Benchmark\Runner.pas',
Validator in 'Benchmark\Validator.pas',
Utils in 'Matrix\Utils.pas',
Factory in 'Matrix\Factory.pas',
Multiplier in 'Matrix\Multiplier.pas' {$R *.res},
MultImpls in 'Matrix\MultImpls.pas'
{$IFDEF MPI} , MPI {$ENDIF};
{$R *.res}
{$IFDEF MPI}
var
Rank: Integer;
Algorithm: IMultiplier;
Buffer: PAnsiChar;
StrLen: Integer;
AlgName: AnsiString;
A, B, C: TMatrix;
{$ENDIF}
begin
{$IFDEF MPI}
MPI_Init;
MPI_Comm_rank(@Rank);
MPI_Barrier;
if Rank = 0 then
begin
{$ENDIF}
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
{$IFDEF MPI}
StrLen := -1;
MPI_Bcast(@StrLen, 1, MPI_Int, 0);
end
else
begin
While True do
begin
MPI_Bcast(@StrLen, 1, MPI_Int, 0);
if StrLen = -1 then
Break;
GetMem(Buffer, StrLen + 1);
try
Buffer[StrLen] := #0;
MPI_Bcast(Buffer, StrLen + 1, MPI_CHAR, 0);
AlgName := AnsiString(Buffer);
Algorithm := TFactory.CreateByName(string(AlgName));
A := nil;
B := nil;
C := nil;
Algorithm.Multiply(A, B, C, 0, 0, 0, 0);
finally
FreeMem(Buffer);
end;
end;
end;
MPI_Finalize;
{$ENDIF}
end.