Changeset 5275
- Timestamp:
- 02/03/10 03:10:54 (7 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
examples/threads/mtbatch/mtbatch.lgt (modified) (3 diffs)
-
examples/threads/mtbatch/NOTES.txt (modified) (1 diff)
-
examples/threads/mtbatch/SCRIPT.txt (modified) (1 diff)
-
RELEASE_NOTES.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/threads/mtbatch/mtbatch.lgt
r5222 r5275 1 1 2 :- object(mtbatch (_Prolog)).2 :- object(mtbatch). 3 3 4 4 :- info([ 5 version is 1. 2,5 version is 1.3, 6 6 author is 'Paulo Moura', 7 date is 2008/08/30, 8 comment is 'Multi-threading benchmarks.', 9 parameters is ['Prolog'- 'Prolog backend compiler. Supported compilers are SWI-Prolog (swi), YAP (yap), and XSB (xsb).']]). 7 date is 2010/02/01, 8 comment is 'Multi-threading benchmarks. Supports SWI-Prolog, XSB, and YAP.']). 10 9 11 10 :- threaded. … … 490 489 do_benchmark(cop_overhead(_, _, _, _), _). 491 490 492 walltime_begin(Walltime) :- 493 parameter(1, Prolog), 494 walltime_begin(Prolog, Walltime). 495 496 walltime_begin(swi, Walltime) :- 497 get_time(Walltime). 498 walltime_begin(yap, 0.0) :- 499 statistics(walltime, _). 500 walltime_begin(xsb, Walltime) :- 501 walltime(Walltime). 502 503 walltime_end(Walltime) :- 504 parameter(1, Prolog), 505 walltime_end(Prolog, Walltime). 506 507 walltime_end(swi, Walltime) :- 508 get_time(Walltime). 509 walltime_end(yap, Walltime) :- 510 statistics(walltime, [_, Time]), 511 Walltime is Time / 1000. 512 walltime_end(xsb, Walltime) :- 513 walltime(Walltime). 491 :- if(current_logtalk_flag(prolog_dialect, swi)). 492 493 walltime_begin(Walltime) :- 494 get_time(Walltime). 495 496 walltime_end(Walltime) :- 497 get_time(Walltime). 498 499 write_average(Average) :- 500 put_char('\t'), 501 format('~4f', [Average]), 502 flush_output. 503 504 :- elif(current_logtalk_flag(prolog_dialect, yap)). 505 506 walltime_begin(0.0) :- 507 statistics(walltime, _). 508 509 walltime_end(Walltime) :- 510 statistics(walltime, [_, Time]), 511 Walltime is Time / 1000. 512 513 write_average(Average) :- 514 put_char('\t'), 515 format('~4f', [Average]), 516 flush_output. 517 518 :- elif(current_logtalk_flag(prolog_dialect, xsb)). 519 520 walltime_begin(Walltime) :- 521 walltime(Walltime). 522 523 walltime_end(xsb, Walltime) :- 524 walltime(Walltime). 525 526 write_average(Average) :- 527 put_char('\t'), 528 fmt_write("%4f", Average), 529 flush_output. 530 531 :- else. 532 533 :- initialization(( 534 write('Unsupported Prolog compiler for running Logtalk multi-threading features.'), 535 halt 536 )). 537 538 :- endif. 514 539 515 540 repeat(_). … … 519 544 repeat(N2). 520 545 521 write_average(Average) :-522 put_char('\t'),523 parameter(1, Prolog),524 write_average(Prolog, Average),525 flush_output.526 527 write_average(swi, Average) :-528 format('~6f', [Average]).529 write_average(yap, Average) :-530 format('~6f', [Average]).531 write_average(xsb, Average) :-532 fmt_write("%6f", Average).533 534 546 write_error :- 535 547 put_char('\t'), 536 write(' *error!*'),548 write('error!'), 537 549 flush_output. 538 550 -
trunk/examples/threads/mtbatch/NOTES.txt
r5274 r5275 12 12 To load this example and for sample queries, please see the SCRIPT.txt file. 13 13 14 This folder provides a parametric object for running multi-threading 15 benchmarks. The object parameter must be instantiated with an atom 16 representing the back-end Prolog compiler being used: 14 This folder provides an object for running multi-threading benchmarks. The 15 supported back-end Prolog compilers are SWI-Prolog, YAP, and XSB. 17 16 18 SWI-Prolog: swi 19 YAP: yap 20 XSB: xsb 17 For example, the following goal will run all benchmark tests: 21 18 22 This is necessary due to the different built-in predicates used by each 23 Prolog compiler for timing statistics. 24 25 For example, the following goal will run all benchmark tests (assuming 26 we're using SWI-Prolog as the back-end compiler): 27 28 | ?- mtbatch(swi)::run. 19 | ?- mtbatch::run. 29 20 30 21 You may also run just a single benchmark test a given number of times. 31 22 For example: 32 23 33 | ?- mtbatch (swi)::run(primes, 10).24 | ?- mtbatch::run(primes, 10). 34 25 35 26 The following tests are available: -
trunk/examples/threads/mtbatch/SCRIPT.txt
r5274 r5275 16 16 17 17 18 % run all tests using SWI-Prolog as the backend compiler:18 % run all tests: 19 19 20 ?- mtbatch (swi)::run.20 ?- mtbatch::run. 21 21 ... 22 22 23 23 24 % run all tests using YAP as the backend compiler:24 % run all tests (average of 20 times for each test): 25 25 26 ?- mtbatch (yap)::run(20).26 ?- mtbatch::run(20). 27 27 ... 28 28 29 29 30 % run the primes benchmark test using XSB as the backend compiler:30 % run the primes benchmark test (average of 10 times): 31 31 32 ?- mtbatch(xsb)::run(primes, 10). 33 ... 32 ?- mtbatch::run(primes, 10). -
trunk/RELEASE_NOTES.txt
r5273 r5275 15 15 16 16 2.38.3 - February ??, 2010 17 18 Simplified usage of the "mtbatch" multi-threading benchmarks example 19 by using conditional compilation directives for the Prolog-specific 20 predicates instead of a parametric object. 17 21 18 22 Update the Windows installer script in order to check for the new
