Files

33 lines
826 B
Ada
Raw Permalink Normal View History

2022-10-27 21:35:23 -04:00
with CUDA.Runtime_Api; use CUDA.Runtime_Api;
with Interfaces.C; use Interfaces.C;
package body Kernel is
2022-11-10 11:20:04 -05:00
procedure Complex_Computation
2022-10-27 21:35:23 -04:00
(A : Float_Array;
B : Float_Array;
C : out Float_Array;
I : Integer)
is
begin
if I < A'Length then
for J in A'First + I .. A'Last loop
for K in B'First + I .. B'Last loop
C (C'First + I) := A (J) + B (K);
end loop;
end loop;
end if;
2022-11-10 11:20:04 -05:00
end Complex_Computation;
2022-10-27 21:35:23 -04:00
procedure Device_Complex_Computation
(A : Array_Device_Access;
B : Array_Device_Access;
C : Array_Device_Access)
is
I : Integer := Integer (Block_Dim.X * Block_IDx.X + Thread_IDx.X);
begin
2022-11-10 11:20:04 -05:00
Complex_Computation (A.all, B.all, C.all, I);
2022-10-27 21:35:23 -04:00
end Device_Complex_Computation;
end Kernel;