/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® quad-core |
Each table row shows performance measurements for this ATS program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 1,000 | 0.10 | 0.11 | ? | 1455 | 0% 0% 0% 100% |
| 4,000 | 1.60 | 1.61 | 392 | 1455 | 1% 100% 0% 8% |
| 16,000 | 25.24 | 25.25 | 392 | 1455 | 0% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read mandelbrot benchmark to see what this program should do.
ATS/Anairiats version 0.2.9
(* ** The Computer Language Benchmarks Game ** http://benchmarksgame.alioth.debian.org/ ** ** contributed by Hongwei Xi ** ** compilation command: ** atscc -O3 -fomit-frame-pointer -D_ISOC9X_SOURCE -mfpmath=sse -msse2 -o mandelbrot_simd mandelbrot_simd.dats ** **) %{^ // vector of two doubles typedef double v2df __attribute__ ((vector_size(16))) ; typedef v2df ats_v2df_type ; %} (* ****** ****** *) abst@ype v2df = $extype "ats_v2df_type" #define TIMES 50 #define LIMIT 2.0; #define LIMIT2 (LIMIT * LIMIT) (* ****** ****** *) %{^ ats_v2df_type ats_zero_v2df = { 0.0, 0.0 } ; ats_v2df_type ats_v2df_make (ats_double_type d0, ats_double_type d1) { v2df dd ; ((double*)&dd)[0] = d0 ; ((double*)&dd)[1] = d1 ; return dd ; } static inline ats_double_type ats_v2df_fst (ats_v2df_type dd) { return ((double*)&dd)[0] ; } static inline ats_double_type ats_v2df_snd (ats_v2df_type dd) { return ((double*)&dd)[1] ; } static inline ats_v2df_type ats_dbl_v2df (ats_v2df_type dd) { return (dd + dd) ; } static inline ats_v2df_type ats_add_v2df_v2df (ats_v2df_type dd1, ats_v2df_type dd2) { return (dd1 + dd2) ; } static inline ats_v2df_type ats_sub_v2df_v2df (ats_v2df_type dd1, ats_v2df_type dd2) { return (dd1 - dd2) ; } static inline ats_v2df_type ats_mul_v2df_v2df (ats_v2df_type dd1, ats_v2df_type dd2) { return (dd1 * dd2) ; } %} extern val zero_v2df: v2df = "ats_zero_v2df" extern fun v2df_make (d0: double, d1: double): v2df = "ats_v2df_make" extern fun v2df_fst (dd: v2df): double = "ats_v2df_fst" extern fun v2df_snd (dd: v2df): double = "ats_v2df_snd" extern fun dbl_v2df (_: v2df): v2df = "ats_dbl_v2df" extern fun add_v2df_v2df (_: v2df, _: v2df): v2df = "ats_add_v2df_v2df" extern fun sub_v2df_v2df (_: v2df, _: v2df): v2df = "ats_sub_v2df_v2df" extern fun mul_v2df_v2df (_: v2df, _: v2df): v2df = "ats_mul_v2df_v2df" overload + with add_v2df_v2df overload - with sub_v2df_v2df overload * with mul_v2df_v2df (* ****** ****** *) #define i2d double_of_int fn mandelbrot (h: int, w: int): void = let val h_recip = 1.0 / (i2d h) and w_recip = 1.0 / (i2d w) fun test (x: int, y: int):<cloref1> int = let val x2 = i2d (x << 1) val Cr0 = x2 * w_recip - 1.5 val Cr1 = (x2 + 2.0) * w_recip - 1.5 val y2 = i2d (y << 1) val Ci0 = y2 * h_recip - 1.0 val Ci1 = Ci0 val Crv = v2df_make (Cr0, Cr1) val Civ = v2df_make (Ci0, Ci1) fun loop ( eo: int , Cr: double, Ci: double, Zr: double, Zi: double , times: int ) :<fun1> int = let (* val () = begin print "loop: Cr = "; print Cr; print_newline (); print "loop: Ci = "; print Ci; print_newline (); print "loop: Zr = "; print Zr; print_newline (); print "loop: Zi = "; print Zi; print_newline (); end *) val Tr = Zr * Zr and Ti = Zi * Zi; val Tri = Tr + Ti (* val () = begin print "loop: eo = "; print eo; print_newline (); print "loop: Tr = "; print Tr; print_newline (); print "loop: Ti = "; print Ti; print_newline (); print "loop: Tri = "; print Tri; print_newline (); end *) in case+ 0 of | _ when Tri <= LIMIT2 => begin if times = 0 then 1 + eo else let val Zr_new = Tr - Ti + Cr val Zi_new = 2.0 * (Zr * Zi) + Ci in loop (eo, Cr, Ci, Zr_new, Zi_new, times-1) end // end of [if] end // end of [_ when ...] | _ => 0 end // end of [loop] fun loopv (Zrv: v2df, Ziv: v2df, times: int):<cloref1> int = let val Trv = Zrv * Zrv and Tiv = Ziv * Ziv; val Triv = Trv + Tiv val Tri0 = v2df_fst (Triv) and Tri1 = v2df_snd (Triv) (* val () = begin print "loopv: Tri0 = "; print Tri0; print_newline (); print "loopv: Tri1 = "; print Tri1; print_newline (); end *) in case+ 0 of | _ when Tri0 <= LIMIT2 => begin case+ 0 of | _ when Tri1 <= LIMIT2 => begin if times = 0 then 0x3 else let val Zrv_new = Trv - Tiv + Crv val Ziv_new = dbl_v2df (Zrv * Ziv) + Civ in loopv (Zrv_new, Ziv_new, times-1) end // end of [if] end // end of [_ when ...] | _ => begin if times = 0 then 0x2 else let val Zr0 = v2df_fst (Zrv) and Zi0 = v2df_fst (Ziv) val Tr0 = v2df_fst (Trv) and Ti0 = v2df_fst (Tiv) val Zr0_new = Tr0 - Ti0 + Cr0 val Zi0_new = 2.0 * (Zr0 * Zi0) + Ci0 in loop (1(*eo*), Cr0, Ci0, Zr0_new, Zi0_new, times-1) end // end of [if] end // end of [_] end // end of [_ when ...] | _ => begin case+ 0 of | _ when Tri1 <= LIMIT2 => begin if times = 0 then 0x1 else let val Zr1 = v2df_snd (Zrv) and Zi1 = v2df_snd (Ziv) val Tr1 = v2df_snd (Trv) and Ti1 = v2df_snd (Tiv) val Zr1_new = Tr1 - Ti1 + Cr1 val Zi1_new = 2.0 * (Zr1 * Zi1) + Ci1 in loop (0(*eo*), Cr1, Ci1, Zr1_new, Zi1_new, times-1) end // end of [if] end // end of [_ when ...] | _ => 0x0 // return value end // end of [_] end // end of [loopv] in loopv (zero_v2df, zero_v2df, TIMES) end // end of [test] #define i2b byte_of_int fun output (x: int, y: int, b: byte, n: natLte 8):<cloref1> void = begin case+ 0 of | _ when x < w => let val res = test (x, y) (* val () = (print "res = "; print res; print_newline ()) *) in case+ 0 of | _ when n >= 2 => begin output (x + 2, y, (b << 2) + i2b res, n - 2) end // end of [_ when ...] | _ (*n=0*) => let (* val () = begin print "b = "; print (int_of_byte b); print_newline () end *) val () = print_byte b in output (x + 2, y, i2b res, 6) end // end of [_] end // end of [_ when ...] | _ => let val () = print_byte (b << n) in if (y < h - 1) then output (0, y + 1, i2b 0, 8) else () end // end of [_] end // end of [output] val () = printf ("P4\n%i %i\n", @(h, w)) in if (h > 0) then output (0, 0, i2b 0, 8) end // end of [mandelbrot] (* ****** ****** *) implement main (argc, argv) = let val () = assert_errmsg_bool1 (argc = 2, "Exit: wrong command format!\n") val i = int1_of_string argv.[1] val () = assert_errmsg_bool1 (i >= 2, "The input integer needs to be at least 2.\n") in mandelbrot (i, i) end // end of [main] (* ****** ****** *) (* end of [mandelbrot_simd.dats] *)
Tue, 22 Jan 2013 19:28:40 GMT MAKE: /usr/local/src/ats-lang-anairiats-0.2.9/bin/atscc -D_GNU_SOURCE -D_ATS_MULTITHREAD -lpthread -pipe -Wall -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 mandelbrot.dats -o mandelbrot.ats-2.ats_run /usr/local/src/ats-lang-anairiats-0.2.9/bin/atsopt --output mandelbrot_dats.c --dynamic mandelbrot.dats In file included from mandelbrot_dats.c:19:0: /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/basics.cats: In function ‘atspre_fprint_newline’: /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/basics.cats:271:11: warning: variable ‘n2’ set but not used [-Wunused-but-set-variable] /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/basics.cats:271:7: warning: variable ‘n1’ set but not used [-Wunused-but-set-variable] mandelbrot_dats.c: In function ‘loop_2’: mandelbrot_dats.c:216:1: warning: label ‘__ats_lab_1_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:191:1: warning: label ‘__ats_lab_0_1’ defined but not used [-Wunused-label] mandelbrot_dats.c:190:1: warning: label ‘__ats_lab_0_0’ defined but not used [-Wunused-label] mandelbrot_dats.c: In function ‘loopv_3’: mandelbrot_dats.c:362:1: warning: label ‘__ats_lab_7_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:339:1: warning: label ‘__ats_lab_6_1’ defined but not used [-Wunused-label] mandelbrot_dats.c:338:1: warning: label ‘__ats_lab_6_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:334:1: warning: label ‘__ats_lab_5_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:311:1: warning: label ‘__ats_lab_4_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:289:1: warning: label ‘__ats_lab_3_1’ defined but not used [-Wunused-label] mandelbrot_dats.c:288:1: warning: label ‘__ats_lab_3_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:282:1: warning: label ‘__ats_lab_2_1’ defined but not used [-Wunused-label] mandelbrot_dats.c:281:1: warning: label ‘__ats_lab_2_0’ defined but not used [-Wunused-label] mandelbrot_dats.c: In function ‘test_1’: mandelbrot_dats.c:429:1: warning: label ‘__ats_lab_test_1’ defined but not used [-Wunused-label] mandelbrot_dats.c: In function ‘output_4’: mandelbrot_dats.c:542:1: warning: label ‘__ats_lab_11_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:527:1: warning: label ‘__ats_lab_10_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:511:1: warning: label ‘__ats_lab_9_1’ defined but not used [-Wunused-label] mandelbrot_dats.c:510:1: warning: label ‘__ats_lab_9_0’ defined but not used [-Wunused-label] mandelbrot_dats.c:504:1: warning: label ‘__ats_lab_8_1’ defined but not used [-Wunused-label] mandelbrot_dats.c:503:1: warning: label ‘__ats_lab_8_0’ defined but not used [-Wunused-label] mandelbrot_dats.c: In function ‘mandelbrot_0’: mandelbrot_dats.c:611:1: warning: label ‘__ats_lab_mandelbrot_0’ defined but not used [-Wunused-label] mandelbrot_dats.c: In function ‘mainats’: mandelbrot_dats.c:642:1: warning: label ‘__ats_lab_mainats’ defined but not used [-Wunused-label] In file included from mandelbrot_dats.c:29:0: mandelbrot_dats.c: At top level: /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/pointer.cats:52:14: warning: ‘atspre_null_ptr’ defined but not used [-Wunused-variable] In file included from mandelbrot_dats.c:30:0: /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/printf.cats:57:1: warning: ‘atspre_fprintf_err’ defined but not used [-Wunused-function] /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/printf.cats:69:1: warning: ‘atspre_fprintf_exn’ defined but not used [-Wunused-function] /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/printf.cats:105:1: warning: ‘atspre_prerrf_exn’ defined but not used [-Wunused-function] In file included from mandelbrot_dats.c:33:0: /usr/local/src/ats-lang-anairiats-0.2.9/prelude/CATS/string.cats:351:14: warning: ‘atspre_stropt_none’ defined but not used [-Wunused-variable] mandelbrot_dats.c:401:1: warning: ‘loopv_3_closure_make’ defined but not used [-Wunused-function] mandelbrot_dats.c:468:1: warning: ‘test_1_closure_make’ defined but not used [-Wunused-function] mandelbrot_dats.c:589:1: warning: ‘output_4_closure_make’ defined but not used [-Wunused-function] gcc -I/usr/local/src/ats-lang-anairiats-0.2.9/ -I/usr/local/src/ats-lang-anairiats-0.2.9/ccomp/runtime/ -L/usr/local/src/ats-lang-anairiats-0.2.9/ccomp/lib64/ /usr/local/src/ats-lang-anairiats-0.2.9/ccomp/runtime/ats_prelude.c -D_GNU_SOURCE -D_ATS_MULTITHREAD -lpthread -pipe -Wall -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 mandelbrot_dats.c -o mandelbrot.ats-2.ats_run -lats_mt -lats 0.33s to complete and log all make actions COMMAND LINE: ./mandelbrot.ats-2.ats_run 16000 (BINARY) PROGRAM OUTPUT NOT SHOWN