|
21 | 21 | (rival-compile exprs vars discs))) |
22 | 22 |
|
23 | 23 | (define results |
24 | | - (filter identity |
25 | | - (for/list ([pt* (in-list (hash-ref rec 'points))] |
26 | | - [pt-id (in-naturals)]) |
27 | | - (match-define (list pt _sollya-exs _sollya-status _sollya-apply-time) pt*) |
28 | | - (define pt-vec |
29 | | - (parameterize ([bf-precision 53]) |
30 | | - (list->vector (map bf pt)))) |
31 | | - (define result (rival-machine-find-optimal-precisions machine pt-vec)) |
32 | | - (match result |
33 | | - [(list optimal-precs optimal-time cur-precs cur-time) |
34 | | - (list pt-id pt optimal-time cur-time)] |
35 | | - [#f |
36 | | - (eprintf "; Benchmark ~a point ~a, failure to optimize\n" bench-id pt-id) |
37 | | - #f])))) |
| 24 | + (filter |
| 25 | + identity |
| 26 | + (for/list ([pt* (in-list (hash-ref rec 'points))] |
| 27 | + [pt-id (in-naturals)]) |
| 28 | + (match-define (list pt _sollya-exs _sollya-status _sollya-apply-time) pt*) |
| 29 | + (define pt-vec |
| 30 | + (parameterize ([bf-precision 53]) |
| 31 | + (list->vector (map bf pt)))) |
| 32 | + (define result (rival-machine-find-optimal-precisions machine pt-vec)) |
| 33 | + (match result |
| 34 | + [(list optimal-precs optimal-time cur-precs cur-time) (list pt-id pt optimal-time cur-time)] |
| 35 | + [#f |
| 36 | + (eprintf "; Benchmark ~a point ~a, failure to optimize\n" bench-id pt-id) |
| 37 | + #f])))) |
38 | 38 |
|
39 | 39 | (define (bad-pt? rec) |
40 | 40 | (match-define (list pt-id pt opt-time cur-time) rec) |
|
44 | 44 | (define dt (* 1000 (- (apply + (map fourth results)) (apply + (map third results))))) |
45 | 45 | (define valid-results (sort (filter bad-pt? results) > #:key fourth)) ; Sort by cur-time |
46 | 46 | (eprintf "; Benchmark ~a, total ~aµs available, ~a bad points\n" |
47 | | - bench-id (~r dt #:precision '(= 1)) (length valid-results)) |
| 47 | + bench-id |
| 48 | + (~r dt #:precision '(= 1)) |
| 49 | + (length valid-results)) |
48 | 50 | (unless (empty? valid-results) |
49 | 51 | (fprintf output-port "; Benchmark ~a, total ~aµs available\n" bench-id (~r dt #:precision '(= 1))) |
50 | 52 | (fprintf output-port |
|
64 | 66 | (define min-speedup (make-parameter 1.2)) |
65 | 67 | (command-line |
66 | 68 | #:once-each [("--min") n "Minimum speedup to report" (min-speedup (string->number n))] |
67 | | - #:args ([points-file "infra/points.json"] |
68 | | - [output-file "optimaize.rival"]) |
| 69 | + #:args ([points-file "infra/points.json"] [output-file "optimaize.rival"]) |
69 | 70 | (printf "Analyzing points bad precision assignment (min speedup: ~a)...\n\n" (min-speedup)) |
70 | | - (call-with-output-file output-file #:exists 'replace |
71 | | - (λ (out-port) |
72 | | - (call-with-input-file points-file |
73 | | - (λ (input) |
74 | | - (for ([rec (in-port read-json input)] |
75 | | - [bench-id (in-naturals)]) |
76 | | - (analyze-program rec bench-id (min-speedup) out-port)))))))) |
| 71 | + (call-with-output-file |
| 72 | + output-file |
| 73 | + #:exists 'replace |
| 74 | + (λ (out-port) |
| 75 | + (call-with-input-file points-file |
| 76 | + (λ (input) |
| 77 | + (for ([rec (in-port read-json input)] |
| 78 | + [bench-id (in-naturals)]) |
| 79 | + (analyze-program rec bench-id (min-speedup) out-port)))))))) |
0 commit comments