| … | … | @@ -1,4 +1,31 @@ |
| 1 | 1 | |
| 2 | /* Copyright (C) 1991-2012 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <http://www.gnu.org/licenses/>. */ |
| 18 | /* This header is separate from features.h so that the compiler can |
| 19 | include it implicitly at the start of every compilation. It must |
| 20 | not itself include <features.h> or any other header that includes |
| 21 | <features.h> because the implicit include comes before any feature |
| 22 | test macros that may be defined in a source file before it first |
| 23 | explicitly includes a system header. GCC knows the name of this |
| 24 | header in order to preinclude it. */ |
| 25 | /* We do support the IEC 559 math functionality, real and complex. */ |
| 26 | /* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) / |
| 27 | Unicode 6.0. */ |
| 28 | /* We do not support C11 <threads.h>. */ |
| 2 | 29 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced |
| 3 | 30 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National |
| 4 | 31 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC |
| … | … | @@ -36,11 +63,9 @@ |
| 36 | 63 | * @date Thu Jun 6 2013 |
| 37 | 64 | */ |
| 38 | 65 | // |
| 39 | | |
| 40 | 66 | #ifdef _OPENMP |
| 41 | 67 | #include <omp.h> |
| 42 | 68 | #endif |
| 43 | | |
| 44 | 69 | #include "HashFactory.h" |
| 45 | 70 | #ifdef HAVE_OPENCL |
| 46 | 71 | #ifdef __APPLE_CC__ |
| … | … | @@ -124,9 +149,7 @@ int clFinish(int command_queue) { |
| 124 | 149 | } |
| 125 | 150 | #endif |
| 126 | 151 | #define PRIME_NUM_CHECKS 20 |
| 127 | | |
| 128 | 152 | #include <math.h> |
| 129 | | |
| 130 | 153 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced |
| 131 | 154 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National |
| 132 | 155 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC |
| … | … | @@ -158,7 +181,6 @@ int clFinish(int command_queue) { |
| 158 | 181 | * |
| 159 | 182 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 |
| 160 | 183 | */ |
| 161 | | |
| 162 | 184 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced |
| 163 | 185 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National |
| 164 | 186 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC |
| … | … | @@ -314,7 +336,6 @@ int clFinish(int command_queue) { |
| 314 | 336 | * |
| 315 | 337 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 |
| 316 | 338 | */ |
| 317 | | |
| 318 | 339 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced |
| 319 | 340 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National |
| 320 | 341 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC |
| … | … | @@ -439,19 +460,14 @@ int clFinish(int command_queue) { |
| 439 | 460 | * |
| 440 | 461 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 |
| 441 | 462 | */ |
| 442 | | |
| 443 | 463 | static int reportLevel = 0; |
| 444 | | |
| 445 | 464 | const char *HashFactory_source; |
| 446 | | |
| 447 | 465 | const char *Hash_GetKernelSourceString() { |
| 448 | 466 | return HashFactory_source; |
| 449 | 467 | } |
| 450 | | |
| 451 | 468 | size_t roundUpToNearest(size_t x, size_t r) { |
| 452 | 469 | return (((x - 1) / r) + 1) * r; |
| 453 | 470 | } |
| 454 | | |
| 455 | 471 | int modularPow(int base, int exponent, int modulus) { |
| 456 | 472 | int result = 1; |
| 457 | 473 | while (exponent) { |
| … | … | @@ -462,7 +478,6 @@ int modularPow(int base, int exponent, int modulus) { |
| 462 | 478 | } |
| 463 | 479 | return result; |
| 464 | 480 | } |
| 465 | | |
| 466 | 481 | int largestProthPrimeUnder(int N) { |
| 467 | 482 | if (N < 4) { |
| 468 | 483 | return N; |
| … | … | @@ -493,7 +508,6 @@ int largestProthPrimeUnder(int N) { |
| 493 | 508 | } |
| 494 | 509 | return 3; |
| 495 | 510 | } |
| 496 | | |
| 497 | 511 | int smallestProthPrimeAbove(int N) { |
| 498 | 512 | if (N < 4) { |
| 499 | 513 | return N; |
| … | … | @@ -524,7 +538,6 @@ int smallestProthPrimeAbove(int N) { |
| 524 | 538 | } |
| 525 | 539 | return 3; |
| 526 | 540 | } |
| 527 | | |
| 528 | 541 | int intLog2(int n) { |
| 529 | 542 | int result = 0; |
| 530 | 543 | while (n >>= 1) { |
| … | … | @@ -532,15 +545,12 @@ int intLog2(int n) { |
| 532 | 545 | } |
| 533 | 546 | return result; |
| 534 | 547 | } |
| 535 | | |
| 536 | 548 | void Hash_SetReportLevel(int level) { |
| 537 | 549 | reportLevel = level; |
| 538 | 550 | } |
| 539 | | |
| 540 | 551 | int Hash_GetReportLevel() { |
| 541 | 552 | return reportLevel; |
| 542 | 553 | } |
| 543 | | |
| 544 | 554 | char *Hash_ExitCodeString(int exitCode) { |
| 545 | 555 | switch (exitCode) { |
| 546 | 556 | case HASH_EXIT_CODE_NORMAL: |
| … | … | @@ -559,7 +569,6 @@ char *Hash_ExitCodeString(int exitCode) { |
| 559 | 569 | return "Unknown"; |
| 560 | 570 | } |
| 561 | 571 | } |
| 562 | | |
| 563 | 572 | void Hash_ExitCodeDebug(int exitCode) { |
| 564 | 573 | if (exitCode != HASH_EXIT_CODE_NORMAL) { |
| 565 | 574 | printf("HashExitCode: %s\n", Hash_ExitCodeString(exitCode)); |
| … | … | @@ -5794,6 +5803,33 @@ int intintLCGQuadraticOpenCompactOpenMPHash_InsertNoOverwrite(intintHash_Table * |
| 5794 | 5803 | } |
| 5795 | 5804 | const char *HashFactory_source = |
| 5796 | 5805 | "\n" |
| 5806 | "/* Copyright (C) 1991-2012 Free Software Foundation, Inc.\n" |
| 5807 | " This file is part of the GNU C Library.\n" |
| 5808 | "\n" |
| 5809 | " The GNU C Library is free software; you can redistribute it and/or\n" |
| 5810 | " modify it under the terms of the GNU Lesser General Public\n" |
| 5811 | " License as published by the Free Software Foundation; either\n" |
| 5812 | " version 2.1 of the License, or (at your option) any later version.\n" |
| 5813 | "\n" |
| 5814 | " The GNU C Library is distributed in the hope that it will be useful,\n" |
| 5815 | " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" |
| 5816 | " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" |
| 5817 | " Lesser General Public License for more details.\n" |
| 5818 | "\n" |
| 5819 | " You should have received a copy of the GNU Lesser General Public\n" |
| 5820 | " License along with the GNU C Library; if not, see\n" |
| 5821 | " <http://www.gnu.org/licenses/>. */\n" |
| 5822 | "/* This header is separate from features.h so that the compiler can\n" |
| 5823 | " include it implicitly at the start of every compilation. It must\n" |
| 5824 | " not itself include <features.h> or any other header that includes\n" |
| 5825 | " <features.h> because the implicit include comes before any feature\n" |
| 5826 | " test macros that may be defined in a source file before it first\n" |
| 5827 | " explicitly includes a system header. GCC knows the name of this\n" |
| 5828 | " header in order to preinclude it. */\n" |
| 5829 | "/* We do support the IEC 559 math functionality, real and complex. */\n" |
| 5830 | "/* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) /\n" |
| 5831 | " Unicode 6.0. */\n" |
| 5832 | "/* We do not support C11 <threads.h>. */\n" |
| 5797 | 5833 | "/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced\n" |
| 5798 | 5834 | " * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National \n" |
| 5799 | 5835 | " * Laboratory (LANL), which is operated by Los Alamos National Security, LLC\n" |
| … | … | @@ -5825,7 +5861,6 @@ const char *HashFactory_source = |
| 5825 | 5861 | " *\n" |
| 5826 | 5862 | " * This is LANL Copyright Disclosure C14043/LA-CC-14-003\n" |
| 5827 | 5863 | " */\n" |
| 5828 | | "\n" |
| 5829 | 5864 | "int intintIdentityPerfectCLHash_InsertSingle(__global char *tableData,\n" |
| 5830 | 5865 | " int key, int value);\n" |
| 5831 | 5866 | "int intintIdentityPerfectCLHash_InnerInsertSingle(__global char *tableData,\n" |
| … | … | @@ -6023,7 +6058,6 @@ const char *HashFactory_source = |
| 6023 | 6058 | " __global int *values);\n" |
| 6024 | 6059 | "int intintHash_InsertSingleNoOverwrite(__global char *tableData, int key,\n" |
| 6025 | 6060 | " int value);\n" |
| 6026 | | "\n" |
| 6027 | 6061 | "#define HASH_REPORT_NEVER /**/ 0\n" |
| 6028 | 6062 | "#define HASH_REPORT_CYCLE /**/ 1\n" |
| 6029 | 6063 | "#define HASH_REPORT_END /****/ 2\n" |