diff --git a/website/websites/u32/code/threadring.4.gnat.code b/website/websites/u32/code/threadring.4.gnat.code new file mode 100644 index 0000000000..86750a6709 --- /dev/null +++ b/website/websites/u32/code/threadring.4.gnat.code @@ -0,0 +1,113 @@ +-- The Computer Language Benchmarks Game +-- http://shootout.alioth.debian.org/ +-- Contributed by Jacob Sparre Andersen (with help from Alex Mason) +-- +-- Modified by Francois Fabien (9 mai 2011) +-- Compile with: +-- gnatmake -gnatVn -O3 -gnatp threadring.adb + +-- pragmas used for optimization of the run-time. +pragma Restrictions (Simple_Barriers); +pragma Restrictions (No_Abort_Statements); +pragma Restrictions (No_Asynchronous_Control); +pragma Restrictions (No_Calendar); +pragma Restrictions (No_Delay); +pragma Restrictions (No_Dynamic_Attachment); +pragma Restrictions (No_Dynamic_Priorities); +pragma Restrictions (No_Entry_Calls_In_Elaboration_Code); +pragma Restrictions (No_Entry_Queue); +pragma Restrictions (No_Exception_Registration); +pragma Restrictions (No_Initialize_Scalars); +pragma Restrictions (No_Local_Protected_Objects); +pragma Restrictions (No_Protected_Type_Allocators); +pragma Restrictions (No_Relative_Delay); +pragma Restrictions (No_Requeue_Statements); +pragma Restrictions (No_Select_Statements); +pragma Restrictions (No_Streams); +pragma Restrictions (No_Task_Allocators); +pragma Restrictions (No_Task_Attributes_Package); +pragma Restrictions (No_Task_Termination); +pragma Restrictions (No_Terminate_Alternatives); +pragma Restrictions (Static_Priorities); +pragma Restrictions (Static_Storage_Size); +pragma Restrictions (Immediate_Reclamation); +pragma Restrictions (No_Wide_Characters); +pragma Restrictions (Max_Protected_Entries => 1); +pragma Restrictions (Max_Select_Alternatives => 0); +pragma Restrictions (Max_Task_Entries => 1); +pragma Restrictions (Max_Asynchronous_Select_Nesting => 0); +pragma Restrictions (No_Nested_Finalization); + +with Ada.Text_IO, Ada.Command_Line; +use Ada; + +procedure Threadring is + + Ring_Size : constant := 503; + type Ring_Index is mod Ring_Size;-- 0 to 502 + + package Int_IO is new Text_IO.Integer_IO (Integer); + + pragma Warnings (Off); + protected type Semaphore is + entry Seize (Item : out Integer); + procedure Release (Item : in Integer); + private + Value : Integer; + Ready : Boolean := False; + end Semaphore; + + protected body Semaphore is + entry Seize (Item : out Integer) when Ready is + begin + Item := Value; + Ready := False; + end Seize; + + procedure Release (Item : in Integer) is + begin + Value := Item; + Ready := True; + end Release; + end Semaphore; + pragma Warnings (On); + + type Semaphore_Ring is array (Ring_Index) of Semaphore; + Semaphores : Semaphore_Ring; + + -- tasks are mapped on OS threads. + task type Node is + entry Initialize (Identifier : in Ring_Index); + end Node; + + task body Node is + ID : Ring_Index; + Token : Integer; + begin + accept Initialize (Identifier : in Ring_Index) do + ID := Identifier; + end Initialize; + + loop + Semaphores (ID).Seize (Token); + if Token = 0 then + Int_IO.Put (Integer (ID) + 1, Width => 0); + Text_IO.New_Line; + end if; + Semaphores (ID + 1).Release (Token - 1); + exit when Token < 0; + end loop; + + end Node; + + type Node_Ring is array (Ring_Index) of Node; + Nodes : Node_Ring; + +begin + for ID in Nodes'Range loop + Nodes (ID).Initialize (Identifier => ID); + end loop; + + Semaphores (Ring_Index'First).Release + (Integer'Value (Ada.Command_Line.Argument (1))); +end Threadring; diff --git a/website/websites/u32/code/threadring.4.gnat.log b/website/websites/u32/code/threadring.4.gnat.log new file mode 100644 index 0000000000..5dcc7b9752 --- /dev/null +++ b/website/websites/u32/code/threadring.4.gnat.log @@ -0,0 +1,20 @@ + +Mon, 09 May 2011 23:59:19 GMT + +MAKE: +/usr/bin/gnatchop -r -w threadring.gnat-4.gnat +splitting threadring.gnat-4.gnat into: + threadring.adb +/usr/bin/gnatmake -gnatEpVn -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 -f threadring.adb -o threadring.gnat-4.gnat_run +gcc-4.4 -c -gnatEpVn -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 threadring.adb +gnatbind -x threadring.ali +gnatlink threadring.ali -fomit-frame-pointer -march=native -mfpmath=sse -msse2 -o threadring.gnat-4.gnat_run +0.38s to complete and log all make actions + +COMMAND LINE: +./threadring.gnat-4.gnat_run 50000000 + +TIMED OUT after 3600s + + +PROGRAM OUTPUT: diff --git a/website/websites/u32/data/data.csv b/website/websites/u32/data/data.csv index ce1d514f0e..29e50b6244 100644 --- a/website/websites/u32/data/data.csv +++ b/website/websites/u32/data/data.csv @@ -675,6 +675,7 @@ threadring,java,4,50000000,894,30.698,137172,0,0% 0% 0% 100%,30.839 threadring,perl,3,50000000,489,493.011,498904,0,0% 0% 0% 100%,493.320 threadring,java,5,50000000,432,16.233,72668,0,0% 0% 0% 100%,16.249 threadring,ocaml,3,50000000,296,115.711,2952,0,0% 0% 0% 100%,115.745 +threadring,gnat,4,50000000,949,0.000,6584,-1,1% 1% 0% 4%,3604.440 threadring,fsharp,2,50000000,612,0.000,33024,-1,0% 0% 0% 1%,3604.262 threadring,ruby,2,50000000,228,2112.200,17372,0,0% 0% 0% 100%,2111.227 threadring,vw,2,50000000,566,41.155,17632,0,0% 0% 0% 100%,41.152 diff --git a/website/websites/u32/data/ndata.csv b/website/websites/u32/data/ndata.csv index 585943d453..6488ab0b81 100644 --- a/website/websites/u32/data/ndata.csv +++ b/website/websites/u32/data/ndata.csv @@ -1955,6 +1955,9 @@ threadring,java,5,50000000,432,16.233,72668,0,0% 0% 0% 100%,16.249 threadring,ocaml,3,500000,296,1.188,2952,0,0% 0% 2% 100%,1.194 threadring,ocaml,3,5000000,296,11.669,2948,0,0% 0% 1% 100%,11.679 threadring,ocaml,3,50000000,296,115.711,2952,0,0% 0% 0% 100%,115.745 +threadring,gnat,4,500000,949,1.972,6584,0,0% 1% 1% 99%,1.986 +threadring,gnat,4,5000000,949,19.193,6588,0,0% 0% 0% 100%,19.217 +threadring,gnat,4,50000000,949,0.000,6584,-1,1% 1% 0% 4%,3604.440 threadring,fsharp,2,500000,612,2.840,18088,0,0% 2% 0% 100%,2.855 threadring,fsharp,2,5000000,612,27.210,33416,0,0% 0% 0% 100%,27.235 threadring,fsharp,2,50000000,612,0.000,33024,-1,0% 0% 0% 1%,3604.262 diff --git a/website/websites/u32/data/u32_bulkdata.csv.bz2 b/website/websites/u32/data/u32_bulkdata.csv.bz2 index 5b58f1a67c..f02243d25e 100644 Binary files a/website/websites/u32/data/u32_bulkdata.csv.bz2 and b/website/websites/u32/data/u32_bulkdata.csv.bz2 differ diff --git a/website/websites/u32q/code/threadring.4.gnat.code b/website/websites/u32q/code/threadring.4.gnat.code new file mode 100644 index 0000000000..86750a6709 --- /dev/null +++ b/website/websites/u32q/code/threadring.4.gnat.code @@ -0,0 +1,113 @@ +-- The Computer Language Benchmarks Game +-- http://shootout.alioth.debian.org/ +-- Contributed by Jacob Sparre Andersen (with help from Alex Mason) +-- +-- Modified by Francois Fabien (9 mai 2011) +-- Compile with: +-- gnatmake -gnatVn -O3 -gnatp threadring.adb + +-- pragmas used for optimization of the run-time. +pragma Restrictions (Simple_Barriers); +pragma Restrictions (No_Abort_Statements); +pragma Restrictions (No_Asynchronous_Control); +pragma Restrictions (No_Calendar); +pragma Restrictions (No_Delay); +pragma Restrictions (No_Dynamic_Attachment); +pragma Restrictions (No_Dynamic_Priorities); +pragma Restrictions (No_Entry_Calls_In_Elaboration_Code); +pragma Restrictions (No_Entry_Queue); +pragma Restrictions (No_Exception_Registration); +pragma Restrictions (No_Initialize_Scalars); +pragma Restrictions (No_Local_Protected_Objects); +pragma Restrictions (No_Protected_Type_Allocators); +pragma Restrictions (No_Relative_Delay); +pragma Restrictions (No_Requeue_Statements); +pragma Restrictions (No_Select_Statements); +pragma Restrictions (No_Streams); +pragma Restrictions (No_Task_Allocators); +pragma Restrictions (No_Task_Attributes_Package); +pragma Restrictions (No_Task_Termination); +pragma Restrictions (No_Terminate_Alternatives); +pragma Restrictions (Static_Priorities); +pragma Restrictions (Static_Storage_Size); +pragma Restrictions (Immediate_Reclamation); +pragma Restrictions (No_Wide_Characters); +pragma Restrictions (Max_Protected_Entries => 1); +pragma Restrictions (Max_Select_Alternatives => 0); +pragma Restrictions (Max_Task_Entries => 1); +pragma Restrictions (Max_Asynchronous_Select_Nesting => 0); +pragma Restrictions (No_Nested_Finalization); + +with Ada.Text_IO, Ada.Command_Line; +use Ada; + +procedure Threadring is + + Ring_Size : constant := 503; + type Ring_Index is mod Ring_Size;-- 0 to 502 + + package Int_IO is new Text_IO.Integer_IO (Integer); + + pragma Warnings (Off); + protected type Semaphore is + entry Seize (Item : out Integer); + procedure Release (Item : in Integer); + private + Value : Integer; + Ready : Boolean := False; + end Semaphore; + + protected body Semaphore is + entry Seize (Item : out Integer) when Ready is + begin + Item := Value; + Ready := False; + end Seize; + + procedure Release (Item : in Integer) is + begin + Value := Item; + Ready := True; + end Release; + end Semaphore; + pragma Warnings (On); + + type Semaphore_Ring is array (Ring_Index) of Semaphore; + Semaphores : Semaphore_Ring; + + -- tasks are mapped on OS threads. + task type Node is + entry Initialize (Identifier : in Ring_Index); + end Node; + + task body Node is + ID : Ring_Index; + Token : Integer; + begin + accept Initialize (Identifier : in Ring_Index) do + ID := Identifier; + end Initialize; + + loop + Semaphores (ID).Seize (Token); + if Token = 0 then + Int_IO.Put (Integer (ID) + 1, Width => 0); + Text_IO.New_Line; + end if; + Semaphores (ID + 1).Release (Token - 1); + exit when Token < 0; + end loop; + + end Node; + + type Node_Ring is array (Ring_Index) of Node; + Nodes : Node_Ring; + +begin + for ID in Nodes'Range loop + Nodes (ID).Initialize (Identifier => ID); + end loop; + + Semaphores (Ring_Index'First).Release + (Integer'Value (Ada.Command_Line.Argument (1))); +end Threadring; diff --git a/website/websites/u32q/code/threadring.4.gnat.log b/website/websites/u32q/code/threadring.4.gnat.log new file mode 100644 index 0000000000..247066e76f --- /dev/null +++ b/website/websites/u32q/code/threadring.4.gnat.log @@ -0,0 +1,18 @@ + +Mon, 09 May 2011 23:53:34 GMT + +MAKE: +/usr/bin/gnatchop -r -w threadring.gnat-4.gnat +splitting threadring.gnat-4.gnat into: + threadring.adb +/usr/bin/gnatmake -gnatEpVn -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 -f threadring.adb -o threadring.gnat-4.gnat_run +gcc-4.4 -c -gnatEpVn -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 threadring.adb +gnatbind -x threadring.ali +gnatlink threadring.ali -fomit-frame-pointer -march=native -mfpmath=sse -msse2 -o threadring.gnat-4.gnat_run +2.00s to complete and log all make actions + +COMMAND LINE: +./threadring.gnat-4.gnat_run 50000000 + +PROGRAM OUTPUT: +292 diff --git a/website/websites/u32q/data/data.csv b/website/websites/u32q/data/data.csv index ee92baa563..04a8be47a2 100644 --- a/website/websites/u32q/data/data.csv +++ b/website/websites/u32q/data/data.csv @@ -552,6 +552,7 @@ threadring,java,4,50000000,894,41.503,113032,0,24% 24% 25% 29%,38.054 threadring,perl,3,50000000,489,759.091,498464,0,26% 29% 29% 27%,574.787 threadring,java,5,50000000,432,22.681,47828,0,25% 26% 25% 27%,20.525 threadring,ocaml,3,50000000,296,303.219,2948,0,4% 45% 45% 2%,224.224 +threadring,gnat,4,50000000,949,412.438,6588,0,1% 51% 51% 1%,295.776 threadring,fsharp,2,50000000,612,0.000,32308,-1,0% 0% 0% 0%,3604.090 threadring,ruby,2,50000000,228,0.000,0,-11,%,0.000 threadring,clojure,1,50000000,348,80.525,371540,0,22% 27% 31% 30%,71.287 diff --git a/website/websites/u32q/data/ndata.csv b/website/websites/u32q/data/ndata.csv index 20d1e1eb18..16d963e35e 100644 --- a/website/websites/u32q/data/ndata.csv +++ b/website/websites/u32q/data/ndata.csv @@ -1604,6 +1604,9 @@ threadring,java,5,50000000,432,22.681,47828,0,25% 26% 25% 27%,20.525 threadring,ocaml,3,500000,296,2.824,2948,0,51% 10% 6% 45%,2.111 threadring,ocaml,3,5000000,296,30.218,2952,0,3% 44% 43% 2%,22.346 threadring,ocaml,3,50000000,296,303.219,2948,0,4% 45% 45% 2%,224.224 +threadring,gnat,4,500000,949,4.248,6584,0,4% 47% 54% 1%,3.088 +threadring,gnat,4,5000000,949,41.527,6588,0,50% 1% 2% 51%,29.887 +threadring,gnat,4,50000000,949,412.438,6588,0,1% 51% 51% 1%,295.776 threadring,fsharp,2,500000,612,10.329,18320,0,42% 37% 41% 42%,5.545 threadring,fsharp,2,5000000,612,0.000,32308,-1,0% 0% 0% 0%,3604.090 threadring,fsharp,2,50000000,612,0.000,32308,-1,0% 0% 0% 0%,3604.090 diff --git a/website/websites/u32q/data/u32q_bulkdata.csv.bz2 b/website/websites/u32q/data/u32q_bulkdata.csv.bz2 index b871e85650..f40fedb669 100644 Binary files a/website/websites/u32q/data/u32q_bulkdata.csv.bz2 and b/website/websites/u32q/data/u32q_bulkdata.csv.bz2 differ