Merge pull request #425 from libtom/replace-gen-by-cat replace gen.pl by cat, rename mpi.c to mp_all.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955
diff --git a/.gitignore b/.gitignore
index f1c0a05..61495ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,8 +60,8 @@ UpgradeLog*.htm
perf.data
perf.data.old
-# ignore mpi.c generated by make
-mpi.c
+# ignore tommath_amalgam.c generated by make
+tommath_amalgam.c
# ignore file generated by make tune
tuning_list
@@ -97,4 +97,7 @@ test_*.txt
doc/pics/*.ps
doc/*.bak*
+logs/*.png
+logs/*-*.dem
+
callgraph.txt
diff --git a/demo/timing.c b/demo/timing.c
index fa5669c..8541250 100644
--- a/demo/timing.c
+++ b/demo/timing.c
@@ -20,6 +20,11 @@
#define LTM_TIMING_RAND_SEED 23
#endif
+#ifndef MP_VERSION
+#define MP_TIMING_VERSION
+#else
+#define MP_TIMING_VERSION "-" MP_VERSION
+#endif
static void ndraw(const mp_int *a, const char *name)
{
@@ -85,25 +90,28 @@ static uint64_t TIMFUNC(void)
#endif
}
+#define DO2(x) x; x
+#define DO4(x) DO2(x); DO2(x)
+#define DO8(x) DO4(x); DO4(x)
+
#if 1
-#define DO(x) x; x;
+#define DO(x) DO2(x)
#else
-#define DO2(x) x; x;
-#define DO4(x) DO2(x); DO2(x);
-#define DO8(x) DO4(x); DO4(x);
-#define DO(x) DO8(x); DO8(x);
+#define DO(x) DO8(x); DO8(x)
#endif
#ifdef TIMING_NO_LOGS
-#define FOPEN(a, b) NULL
+#define FOPEN(a, b) NULL
#define FPRINTF(a,b,c,d)
#define FFLUSH(a)
-#define FCLOSE(a) (void)(a)
+#define FCLOSE(a) (void)(a)
+#define PRINTLN(fm,b,n,m) printf(fm "\n", b, n, m)
#else
-#define FOPEN(a,b) fopen(a,b)
-#define FPRINTF(a,b,c,d) fprintf(a,b,c,d)
-#define FFLUSH(a) fflush(a)
-#define FCLOSE(a) fclose(a)
+#define FOPEN(a,b) fopen(a,b)
+#define FPRINTF(a,b,c,d) fprintf(a,b,c,d)
+#define FFLUSH(a) fflush(a)
+#define FCLOSE(a) fclose(a)
+#define PRINTLN(fm,b,n,m) do { printf("\r" fm, b, n, m); fflush(stdout); }while(0)
#endif
static int should_test(const char *test, int argc, char **argv)
@@ -178,19 +186,20 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
} while (++rr < 100u);
- printf("Prime-check\t%s(%2d) => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
- name, cnt, CLK_PER_SEC / tt, tt);
+ PRINTLN("Prime-check\t%s(%2d) => %9" PRIu64 "/sec, %9" PRIu64 " cycles",
+ name, cnt, CLK_PER_SEC / tt, tt);
}
}
}
#endif
if (should_test("add", argc, argv) != 0) {
- log = FOPEN("logs/add.log", "w");
+ log = FOPEN("logs/add" MP_TIMING_VERSION ".log", "w");
for (cnt = 8; cnt <= 128; cnt += 8) {
SLEEP;
mp_rand(&a, cnt);
mp_rand(&b, cnt);
+ DO8(mp_add(&a, &b, &c));
rr = 0u;
tt = UINT64_MAX;
do {
@@ -200,20 +209,22 @@ int main(int argc, char **argv)
if (tt > gg)
tt = gg;
} while (++rr < 100000u);
- printf("Adding\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
- mp_count_bits(&a), CLK_PER_SEC / tt, tt);
+ PRINTLN("Adding\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles",
+ mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%6d %9" PRIu64 "\n", cnt * MP_DIGIT_BIT, tt);
FFLUSH(log);
}
FCLOSE(log);
+ printf("\n");
}
if (should_test("sub", argc, argv) != 0) {
- log = FOPEN("logs/sub.log", "w");
+ log = FOPEN("logs/sub" MP_TIMING_VERSION ".log", "w");
for (cnt = 8; cnt <= 128; cnt += 8) {
SLEEP;
mp_rand(&a, cnt);
mp_rand(&b, cnt);
+ DO8(mp_sub(&a, &b, &c));
rr = 0u;
tt = UINT64_MAX;
do {
@@ -224,12 +235,13 @@ int main(int argc, char **argv)
tt = gg;
} while (++rr < 100000u);
- printf("Subtracting\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
- mp_count_bits(&a), CLK_PER_SEC / tt, tt);
+ PRINTLN("Subtracting\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles",
+ mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%6d %9" PRIu64 "\n", cnt * MP_DIGIT_BIT, tt);
FFLUSH(log);
}
FCLOSE(log);
+ printf("\n\n");
}
if (should_test("mulsqr", argc, argv) != 0) {
@@ -247,11 +259,13 @@ int main(int argc, char **argv)
MP_TOOM_MUL_CUTOFF = (ix == 2) ? old_toom_m : 9999;
MP_TOOM_SQR_CUTOFF = (ix == 2) ? old_toom_s : 9999;
- log = FOPEN((ix == 0) ? "logs/mult.log" : (ix == 1) ? "logs/mult_kara.log" : "logs/mult_toom.log", "w");
+ log = FOPEN((ix == 0) ? "logs/mult" MP_TIMING_VERSION ".log" : (ix == 1) ? "logs/mult_kara" MP_TIMING_VERSION ".log" :
+ "logs/mult_toom" MP_TIMING_VERSION ".log", "w");
for (cnt = 4; cnt <= (10240 / MP_DIGIT_BIT); cnt += 2) {
SLEEP;
mp_rand(&a, cnt);
mp_rand(&b, cnt);
+ DO8(mp_mul(&a, &b, &c));
rr = 0u;
tt = UINT64_MAX;
do {
@@ -261,17 +275,20 @@ int main(int argc, char **argv)
if (tt > gg)
tt = gg;
} while (++rr < 100u);
- printf("Multiplying\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
- mp_count_bits(&a), CLK_PER_SEC / tt, tt);
+ PRINTLN("Multiplying\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles",
+ mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%6d %9" PRIu64 "\n", mp_count_bits(&a), tt);
FFLUSH(log);
}
FCLOSE(log);
+ printf("\n");
- log = FOPEN((ix == 0) ? "logs/sqr.log" : (ix == 1) ? "logs/sqr_kara.log" : "logs/sqr_toom.log", "w");
+ log = FOPEN((ix == 0) ? "logs/sqr" MP_TIMING_VERSION ".log" : (ix == 1) ? "logs/sqr_kara" MP_TIMING_VERSION ".log" :
+ "logs/sqr_toom" MP_TIMING_VERSION ".log", "w");
for (cnt = 4; cnt <= (10240 / MP_DIGIT_BIT); cnt += 2) {
SLEEP;
mp_rand(&a, cnt);
+ DO8(mp_sqr(&a, &b));
rr = 0u;
tt = UINT64_MAX;
do {
@@ -281,12 +298,13 @@ int main(int argc, char **argv)
if (tt > gg)
tt = gg;
} while (++rr < 100u);
- printf("Squaring\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
- mp_count_bits(&a), CLK_PER_SEC / tt, tt);
+ PRINTLN("Squaring\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles",
+ mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%6d %9" PRIu64 "\n", mp_count_bits(&a), tt);
FFLUSH(log);
}
FCLOSE(log);
+ printf("\n\n");
}
}
@@ -324,10 +342,10 @@ int main(int argc, char **argv)
"1214855636816562637502584060163403830270705000634713483015101384881871978446801224798536155406895823305035467591632531067547890948695117172076954220727075688048751022421198712032848890056357845974246560748347918630050853933697792254955890439720297560693579400297062396904306270145886830719309296352765295712183040773146419022875165382778007040109957609739589875590885701126197906063620133954893216612678838507540777138437797705602453719559017633986486649523611975865005712371194067612263330335590526176087004421363598470302731349138773205901447704682181517904064735636518462452242791676541725292378925568296858010151852326316777511935037531017413910506921922450666933202278489024521263798482237150056835746454842662048692127173834433089016107854491097456725016327709663199738238442164843147132789153725513257167915555162094970853584447993125488607696008169807374736711297007473812256272245489405898470297178738029484459690836250560495461579533254473316340608217876781986188705928270735695752830825527963838355419762516246028680280988020401914551825487349990306976304093109384451438813251211051597392127491464898797406789175453067960072008590614886532333015881171367104445044718144312416815712216611576221546455968770801413440778423979",
NULL
};
- log = FOPEN("logs/expt.log", "w");
- logb = FOPEN("logs/expt_dr.log", "w");
- logc = FOPEN("logs/expt_2k.log", "w");
- logd = FOPEN("logs/expt_2kl.log", "w");
+ log = FOPEN("logs/expt" MP_TIMING_VERSION ".log", "w");
+ logb = FOPEN("logs/expt_dr" MP_TIMING_VERSION ".log", "w");
+ logc = FOPEN("logs/expt_2k" MP_TIMING_VERSION ".log", "w");
+ logd = FOPEN("logs/expt_2kl" MP_TIMING_VERSION ".log", "w");
for (n = 0; primes[n] != NULL; n++) {
SLEEP;
mp_read_radix(&a, primes[n], 10);
@@ -340,6 +358,7 @@ int main(int argc, char **argv)
mp_sub_d(&a, 1uL, &c);
mp_mod(&b, &c, &b);
mp_set(&c, 3uL);
+ DO8(mp_exptmod(&c, &b, &a, &d));
rr = 0u;
tt = UINT64_MAX;
do {
@@ -358,8 +377,8 @@ int main(int argc, char **argv)
draw(&d);
exit(0);
}
- printf("Exponentiating\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
- mp_count_bits(&a), CLK_PER_SEC / tt, tt);
+ PRINTLN("Exponentiating\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles",
+ mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF((n < 3) ? logd : (n < 9) ? logc : (n < 16) ? logb : log,
"%6d %9" PRIu64 "\n", mp_count_bits(&a), tt);
}
@@ -367,10 +386,11 @@ int main(int argc, char **argv)
FCLOSE(logb);
FCLOSE(logc);
FCLOSE(logd);
+ printf("\n");
}
if (should_test("invmod", argc, argv) != 0) {
- log = FOPEN("logs/invmod.log", "w");
+ log = FOPEN("logs/invmod" MP_TIMING_VERSION ".log", "w");
for (cnt = 4; cnt <= 32; cnt += 4) {
SLEEP;
mp_rand(&a, cnt);
@@ -381,6 +401,7 @@ int main(int argc, char **argv)
mp_gcd(&a, &b, &c);
} while (mp_cmp_d(&c, 1uL) != MP_EQ);
+ DO2(mp_invmod(&b, &a, &c));
rr = 0u;
tt = UINT64_MAX;
do {
@@ -395,11 +416,12 @@ int main(int argc, char **argv)
printf("Failed to invert\n");
return 0;
}
- printf("Inverting mod\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
- mp_count_bits(&a), CLK_PER_SEC / tt, tt);
+ PRINTLN("Inverting mod\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles",
+ mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%6d %9" PRIu64 "\n", cnt * MP_DIGIT_BIT, tt);
}
FCLOSE(log);
+ printf("\n");
}
return 0;
diff --git a/gen.pl b/gen.pl
deleted file mode 100644
index 4db24b5..0000000
--- a/gen.pl
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Generates a "single file" you can use to quickly
-# add the whole source without any makefile troubles
-#
-use strict;
-use warnings;
-
-open(my $out, '>', 'mpi.c') or die "Couldn't open mpi.c for writing: $!";
-foreach my $filename (glob '*mp_*.c') {
- open(my $src, '<', $filename) or die "Couldn't open $filename for reading: $!";
- print {$out} "/* Start: $filename */\n";
- print {$out} $_ while <$src>;
- print {$out} "\n/* End: $filename */\n\n";
- close $src or die "Error closing $filename after reading: $!";
-}
-print {$out} "\n/* EOF */\n";
-close $out or die "Error closing mpi.c after writing: $!";
-
-system('perl -pli -e "s/\s*$//" mpi.c');
diff --git a/logs/Makefile b/logs/Makefile
index c2ebaf7..59987e5 100644
--- a/logs/Makefile
+++ b/logs/Makefile
@@ -1,2 +1,9 @@
all:
- gnuplot graphs.dem
+ sed -e 's@\.log@-$(VERSION)\.log@g' graphs.dem > graphs-$(VERSION).dem
+ gnuplot graphs-$(VERSION).dem
+
+cmp:
+ gnuplot before_after.dem
+
+clean:
+ rm -f *-*.log *.png graphs-*.dem
diff --git a/logs/add.log b/logs/add.log
deleted file mode 100644
index 0ed7b70..0000000
--- a/logs/add.log
+++ /dev/null
@@ -1,16 +0,0 @@
- 480 48
- 960 61
- 1440 82
- 1920 97
- 2400 106
- 2880 112
- 3360 127
- 3840 130
- 4320 146
- 4800 157
- 5280 174
- 5760 185
- 6240 200
- 6720 214
- 7200 230
- 7680 244
diff --git a/logs/addsub.png b/logs/addsub.png
deleted file mode 100644
index b8ffef7..0000000
Binary files a/logs/addsub.png and /dev/null differ
diff --git a/logs/before_after.dem b/logs/before_after.dem
new file mode 100644
index 0000000..edb59da
--- /dev/null
+++ b/logs/before_after.dem
@@ -0,0 +1,36 @@
+set terminal png
+set ylabel "Cycles per Operation"
+set xlabel "Operand size (bits)"
+
+set output "addsub-ba.png"
+plot 'add-before.log' smooth bezier title "Addition (before)", \
+ 'add-after.log' smooth bezier title "Addition (after)", \
+ 'sub-before.log' smooth bezier title "Subtraction (before)", \
+ 'sub-after.log' smooth bezier title "Subtraction (after)"
+
+set output "mult-ba.png"
+plot 'mult-before.log' smooth bezier title "Multiplication (without Karatsuba) (before)", \
+ 'mult-after.log' smooth bezier title "Multiplication (without Karatsuba) (after)", \
+ 'mult_kara-before.log' smooth bezier title "Multiplication (Karatsuba) (before)", \
+ 'mult_kara-after.log' smooth bezier title "Multiplication (Karatsuba) (after)"
+
+set output "sqr-ba.png"
+plot 'sqr-before.log' smooth bezier title "Squaring (without Karatsuba) (before)", \
+ 'sqr-after.log' smooth bezier title "Squaring (without Karatsuba) (after)", \
+ 'sqr_kara-before.log' smooth bezier title "Squaring (Karatsuba) (before)", \
+ 'sqr_kara-after.log' smooth bezier title "Squaring (Karatsuba) (after)"
+
+set output "expt-ba.png"
+plot 'expt-before.log' smooth bezier title "Exptmod (Montgomery) (before)", \
+ 'expt-after.log' smooth bezier title "Exptmod (Montgomery) (after)", \
+ 'expt_dr-before.log' smooth bezier title "Exptmod (Dimminished Radix) (before)", \
+ 'expt_dr-after.log' smooth bezier title "Exptmod (Dimminished Radix) (after)", \
+ 'expt_2k-before.log' smooth bezier title "Exptmod (2k Reduction) (before)", \
+ 'expt_2k-after.log' smooth bezier title "Exptmod (2k Reduction) (after)", \
+ 'expt_2kl-before.log' smooth bezier title "Exptmod (2k-l Reduction) (before)", \
+ 'expt_2kl-after.log' smooth bezier title "Exptmod (2k-l Reduction) (after)"
+
+set output "invmod-ba.png"
+plot 'invmod-before.log' smooth bezier title "Modular Inverse (before)", \
+ 'invmod-after.log' smooth bezier title "Modular Inverse (after)"
+
diff --git a/logs/before_after.html b/logs/before_after.html
new file mode 100644
index 0000000..bc866f2
--- /dev/null
+++ b/logs/before_after.html
@@ -0,0 +1,28 @@
+<html>
+<head>
+<title>LibTomMath Log Plots</title>
+</head>
+<body>
+
+<h1>Addition and Subtraction</h1>
+<center><img src=addsub-ba.png></center>
+<hr>
+
+<h1>Multiplication</h1>
+<center><img src=mult-ba.png></center>
+<hr>
+
+<h1>Squaring</h1>
+<center><img src=sqr-ba.png></center>
+<hr>
+
+<h1>Exptmod</h1>
+<center><img src=expt-ba.png></center>
+<hr>
+
+<h1>Modular Inverse</h1>
+<center><img src=invmod-ba.png></center>
+<hr>
+
+</body>
+</html>
diff --git a/logs/expt.log b/logs/expt.log
deleted file mode 100644
index 2e5ee30..0000000
--- a/logs/expt.log
+++ /dev/null
@@ -1,7 +0,0 @@
- 513 446633
- 769 1110301
- 1025 2414927
- 2049 14870787
- 2561 26299761
- 3073 44323310
- 4097 98934292
diff --git a/logs/expt.png b/logs/expt.png
deleted file mode 100644
index 27c53ee..0000000
Binary files a/logs/expt.png and /dev/null differ
diff --git a/logs/expt_2k.log b/logs/expt_2k.log
deleted file mode 100644
index 140b92f..0000000
--- a/logs/expt_2k.log
+++ /dev/null
@@ -1,6 +0,0 @@
- 521 533515
- 607 675230
- 1279 2560713
- 2203 7468422
- 3217 17314246
- 4253 33899969
diff --git a/logs/expt_2kl.log b/logs/expt_2kl.log
deleted file mode 100644
index 1dc495f..0000000
--- a/logs/expt_2kl.log
+++ /dev/null
@@ -1,3 +0,0 @@
- 1024 2210287
- 2048 7940364
- 4096 35903891
diff --git a/logs/expt_dr.log b/logs/expt_dr.log
deleted file mode 100644
index 3752ea8..0000000
--- a/logs/expt_dr.log
+++ /dev/null
@@ -1,7 +0,0 @@
- 532 642330
- 784 1138699
- 1036 1972796
- 1540 3912241
- 2072 7075836
- 3080 16420867
- 4116 32477173
diff --git a/logs/index.html b/logs/index.html
index 4b68c25..8c1ed9d 100644
--- a/logs/index.html
+++ b/logs/index.html
@@ -22,6 +22,3 @@
</body>
</html>
-/* $Source: /cvs/libtom/libtommath/logs/index.html,v $ */
-/* $Revision: 1.2 $ */
-/* $Date: 2005/05/05 14:38:47 $ */
diff --git a/logs/invmod.log b/logs/invmod.log
deleted file mode 100644
index 7d22449..0000000
--- a/logs/invmod.log
+++ /dev/null
@@ -1,8 +0,0 @@
- 240 58197
- 480 86617
- 720 255279
- 960 399626
- 1200 533330
- 1440 470046
- 1680 906754
- 1920 1132009
diff --git a/logs/invmod.png b/logs/invmod.png
deleted file mode 100644
index 5c09e90..0000000
Binary files a/logs/invmod.png and /dev/null differ
diff --git a/logs/mult.log b/logs/mult.log
deleted file mode 100644
index 841b40b..0000000
--- a/logs/mult.log
+++ /dev/null
@@ -1,84 +0,0 @@
- 240 114
- 360 182
- 480 273
- 600 364
- 717 471
- 840 597
- 960 737
- 1080 881
- 1196 1041
- 1318 1215
- 1438 1405
- 1559 1600
- 1679 1812
- 1800 2045
- 1918 2289
- 2040 2534
- 2160 2800
- 2280 3067
- 2397 3375
- 2520 3678
- 2640 4007
- 2759 4325
- 2880 4851
- 3000 5200
- 3117 5557
- 3239 5938
- 3356 6332
- 3480 6741
- 3600 7168
- 3720 7597
- 3840 8054
- 3960 8514
- 4079 8956
- 4198 9451
- 4320 9976
- 4440 10457
- 4560 10973
- 4679 11535
- 4797 12085
- 4920 12639
- 5040 13235
- 5160 13832
- 5279 14454
- 5400 15063
- 5519 15657
- 5640 16339
- 5760 16992
- 5879 17676
- 6000 18380
- 6120 18022
- 6237 18567
- 6360 19259
- 6479 19929
- 6599 20686
- 6719 21180
- 6840 22121
- 6960 22741
- 7080 23664
- 7200 24315
- 7320 25107
- 7439 25945
- 7560 26557
- 7680 27527
- 7799 28341
- 7920 30761
- 8040 31648
- 8159 32628
- 8280 33498
- 8400 34508
- 8520 33657
- 8640 34566
- 8758 35203
- 8878 36356
- 9000 37379
- 9119 38072
- 9240 39390
- 9360 48931
- 9475 66682
- 9600 72564
- 9719 51493
- 9840 52637
- 9960 48247
- 10080 49030
- 10195 50592
diff --git a/logs/mult.png b/logs/mult.png
deleted file mode 100644
index 9681183..0000000
Binary files a/logs/mult.png and /dev/null differ
diff --git a/logs/mult_kara.log b/logs/mult_kara.log
deleted file mode 100644
index 91b59cb..0000000
--- a/logs/mult_kara.log
+++ /dev/null
@@ -1,84 +0,0 @@
- 240 133
- 360 250
- 474 396
- 599 585
- 720 637
- 840 1045
- 960 1212
- 1080 1543
- 1196 1780
- 1320 2005
- 1436 2274
- 1560 2446
- 1680 1985
- 1800 2368
- 1920 2791
- 2038 3620
- 2160 3763
- 2278 3444
- 2400 4158
- 2516 5869
- 2640 6368
- 2753 5384
- 2876 7449
- 3000 6471
- 3114 8540
- 3240 7217
- 3360 9685
- 3476 6759
- 3599 8518
- 3714 8911
- 3840 12345
- 3960 9787
- 4079 11018
- 4196 12033
- 4319 12740
- 4440 12471
- 4558 15251
- 4678 13353
- 4798 15998
- 4920 13395
- 5040 13699
- 5160 14552
- 5280 14972
- 5400 15825
- 5520 16512
- 5639 17379
- 5757 17596
- 5879 18350
- 6000 18976
- 6115 19601
- 6240 20076
- 6354 20515
- 6480 21670
- 6600 22312
- 6716 22647
- 6839 23437
- 6960 24164
- 7080 24723
- 7199 25454
- 7320 26092
- 7440 26912
- 7557 27521
- 7677 28015
- 7800 28885
- 7919 29483
- 8040 30115
- 8160 31236
- 8280 31975
- 8400 30835
- 8520 31565
- 8639 32380
- 8760 32760
- 8879 33590
- 8996 34553
- 9119 35185
- 9239 36146
- 9358 36815
- 9480 39630
- 9596 43022
- 9720 41219
- 9840 41596
- 9960 42354
- 10080 43352
- 10200 43915
diff --git a/logs/sqr.log b/logs/sqr.log
deleted file mode 100644
index 93234a1..0000000
--- a/logs/sqr.log
+++ /dev/null
@@ -1,84 +0,0 @@
- 240 114
- 359 174
- 478 241
- 600 311
- 720 399
- 840 494
- 960 599
- 1080 799
- 1200 931
- 1320 911
- 1440 1016
- 1560 1143
- 1680 1281
- 1800 1459
- 1918 1617
- 2039 1763
- 2159 1913
- 2279 2071
- 2399 2240
- 2518 2412
- 2640 2600
- 2760 2792
- 2877 3008
- 2999 3220
- 3119 3405
- 3239 3637
- 3359 3859
- 3480 4094
- 3600 4328
- 3717 4571
- 3838 4840
- 3960 5098
- 4080 5349
- 4200 5617
- 4320 5891
- 4440 6147
- 4560 6444
- 4680 6745
- 4800 7057
- 4918 7317
- 5039 7637
- 5160 12833
- 5280 10098
- 5397 8666
- 5520 8999
- 5639 9376
- 5758 9727
- 5880 9996
- 6000 10427
- 6118 10868
- 6240 12218
- 6359 14010
- 6478 14838
- 6593 16135
- 6719 16503
- 6840 13267
- 6960 13648
- 7080 14118
- 7199 14525
- 7320 14803
- 7439 15378
- 7558 15871
- 7680 57530
- 7800 59550
- 7916 61091
- 8039 63004
- 8160 61136
- 8279 62803
- 8398 68671
- 8520 71001
- 8638 71537
- 8759 74757
- 8880 77164
- 9000 78963
- 9119 80982
- 9239 83142
- 9357 85292
- 9480 88190
- 9600 90343
- 9718 86710
- 9840 88818
- 9954 91034
- 10079 93350
- 10197 95592
diff --git a/logs/sqr_kara.log b/logs/sqr_kara.log
deleted file mode 100644
index da10897..0000000
--- a/logs/sqr_kara.log
+++ /dev/null
@@ -1,84 +0,0 @@
- 240 115
- 360 175
- 480 241
- 600 312
- 719 397
- 839 494
- 960 597
- 1080 696
- 1200 794
- 1320 908
- 1439 1022
- 1560 1141
- 1678 1284
- 1797 1461
- 1918 1590
- 2040 1764
- 2160 1911
- 2278 2072
- 2399 2263
- 2516 2425
- 2640 2627
- 2756 2809
- 2880 3017
- 3000 3220
- 3119 3413
- 3239 3627
- 3359 3864
- 3479 4087
- 3600 4327
- 3720 4603
- 3840 4867
- 3957 5095
- 4079 5079
- 4200 5623
- 4319 5878
- 4439 6177
- 4560 6467
- 4679 6749
- 4800 7056
- 4920 7384
- 5039 7681
- 5159 8004
- 5280 8332
- 5399 8664
- 5520 8929
- 5638 9340
- 5760 9631
- 5879 10109
- 5999 10458
- 6118 10816
- 6240 11215
- 6359 11550
- 6478 11958
- 6600 12390
- 6718 12801
- 6838 13197
- 6959 13609
- 7079 14033
- 7199 16182
- 7320 16539
- 7440 16952
- 7559 16255
- 7679 17593
- 7800 17107
- 7920 17362
- 8037 17723
- 8159 18072
- 8280 19804
- 8399 18966
- 8519 19510
- 8640 19958
- 8760 20364
- 8878 20674
- 9000 21682
- 9120 21665
- 9237 21945
- 9359 22394
- 9480 23105
- 9598 23334
- 9718 25301
- 9840 26053
- 9960 26565
- 10079 26812
- 10200 27300
diff --git a/logs/sub.log b/logs/sub.log
deleted file mode 100644
index 87c0160..0000000
--- a/logs/sub.log
+++ /dev/null
@@ -1,16 +0,0 @@
- 480 36
- 960 51
- 1440 64
- 1920 78
- 2400 90
- 2880 105
- 3360 118
- 3840 133
- 4320 146
- 4800 161
- 5280 182
- 5760 201
- 6240 201
- 6720 214
- 7200 228
- 7680 243
diff --git a/makefile b/makefile
index b14976f..cb7ba21 100644
--- a/makefile
+++ b/makefile
@@ -64,20 +64,19 @@ $(LIBNAME): $(OBJECTS)
#
# So far I've seen improvements in the MP math
profiled:
- make CFLAGS="$(CFLAGS) -fprofile-arcs -DTESTING" timing
+ make CFLAGS="$(CFLAGS) -fprofile-arcs" timing
./timing
rm -f *.a *.o timing
make CFLAGS="$(CFLAGS) -fbranch-probabilities"
#make a single object profiled library
-profiled_single:
- perl gen.pl
- $(CC) $(LTM_CFLAGS) -fprofile-arcs -DTESTING -c mpi.c -o mpi.o
- $(CC) $(LTM_CFLAGS) -DTESTING -DTIMER demo/timing.c mpi.o -lgcov -o timing
+profiled_single: pre_gen
+ $(CC) $(LTM_CFLAGS) -fprofile-arcs -c pre_gen/tommath_amalgam.c -o tommath_amalgam.o
+ $(CC) $(LTM_CFLAGS) -DMP_VERSION=\"before\" demo/timing.c tommath_amalgam.o -lgcov -o timing
./timing
rm -f *.o timing
- $(CC) $(LTM_CFLAGS) -fbranch-probabilities -DTESTING -c mpi.c -o mpi.o
- $(AR) $(ARFLAGS) $(LIBNAME) mpi.o
+ $(CC) $(LTM_CFLAGS) -fbranch-probabilities -c pre_gen/tommath_amalgam.c -o tommath_amalgam.o
+ $(AR) $(ARFLAGS) $(LIBNAME) tommath_amalgam.o
ranlib $(LIBNAME)
install: $(LIBNAME)
@@ -103,8 +102,8 @@ $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
mtest:
cd mtest ; $(CC) $(LTM_CFLAGS) -O0 mtest.c $(LTM_LFLAGS) -o mtest
-timing: $(LIBNAME) demo/timing.c
- $(CC) $(LTM_CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LTM_LFLAGS) -o timing
+timing: demo/timing.c $(LIBNAME)
+ $(CC) $(LTM_CFLAGS) $^ $(LTM_LFLAGS) -o timing
tune: $(LIBNAME)
$(MAKE) -C etc tune CFLAGS="$(LTM_CFLAGS)"
@@ -118,12 +117,15 @@ coveralls: lcov
docs manual:
$(MAKE) -C doc/ $@ V=$(V)
-.PHONY: pre_gen
+.PHONY: pre_gen cmp
pre_gen:
mkdir -p pre_gen
- perl gen.pl
- sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
- rm mpi.c
+ cat *mp_*.c > pre_gen/tommath_amalgam.c
+
+cmp: profiled_single
+ $(CC) $(LTM_CFLAGS) -DMP_VERSION=\"after\" demo/timing.c $(LIBNAME) -lgcov -o timing
+ ./timing
+ $(MAKE) -C logs/ cmp
zipup: clean astyle new_file docs
@# Update the index, so diff-index won't fail in case the pdf has been created.
diff --git a/makefile_include.mk b/makefile_include.mk
index 650b3e7..4b5961c 100644
--- a/makefile_include.mk
+++ b/makefile_include.mk
@@ -164,7 +164,8 @@ cleancov: cleancov-clean clean
clean:
rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o \
demo/*.o test timing mtest_opponent mtest/mtest mtest/mtest.exe tuning_list \
- *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la
+ *.s tommath_amalgam.c pre_gen/tommath_amalgam.c *.da *.dyn *.dpi tommath.tex \
+ `find . -type f | grep [~] | xargs` *.lo *.la
rm -rf .libs/ demo/.libs
${MAKE} -C etc/ clean MAKE=${MAKE}
${MAKE} -C doc/ clean MAKE=${MAKE}