microsoft/onnxruntime-extensions
Publicmirrored from https://github.com/microsoft/onnxruntime-extensionsAvailable
cmake/externals/farmhash/dev/INSTRUCTIONS
46lines · modecode
| 1 | WARNING: ./builder (built from builder.cc) can modify files in ../src! Backup your files before running it! |
| 2 | WARNING: ./builder (built from builder.cc) can attempt to download SMHasher from the internet, and compile and run it! Consider using a virtual machine or sandbox of some kind! |
| 3 | |
| 4 | USING ./BUILDER |
| 5 | |
| 6 | Some examples of how to use ./builder, assuming you've created /tmp/a as a scratch directory: |
| 7 | |
| 8 | cd ~/farm/farmhash/dev && g++ -std=gnu++0x builder.cc -o builder && DIR=a/$RANDOM ./builder && (cd .. && make check); wc -l ../src/farmhash.cc |
| 9 | |
| 10 | If that works, I also like to do |
| 11 | (cd .. && make clean && make check CXXFLAGS="-msse4.2 -maes") && (cd .. && make clean && make check CXXFLAGS="-msse4.2 -O0") && (cd .. && make clean && make check CXXFLAGS="-maes -O0") && echo yes |
| 12 | |
| 13 | cd ~/farm/farmhash/dev && g++ -std=gnu++0x builder.cc -o builder && DIR=a/$RANDOM TEST=farmhashsa::Hash32 ./builder |
| 14 | |
| 15 | nspace=farmhashsu; fns=$(for i in WithSeed ""; do for j in "" D Q; do echo ${nspace}::Hash32$i$j; done; done | xargs ~/bin/shell/joinargs); cd ~/farm/farmhash/dev && g++ -std=gnu++0x builder.cc -o builder && CMAKE32=1 CXXFLAGS="-DFARMHASH_ASSUME_SSE42 -msse4.2" DIR=a/$RANDOM TEST=$fns PARALLELISM=8 ./builder |
| 16 | |
| 17 | STYLE NOTES |
| 18 | |
| 19 | Some code here is stylistically odd or following unseen rules because |
| 20 | it is processed by scripts. Some of it is terribly hacky. For |
| 21 | example: |
| 22 | |
| 23 | 0. Hash functions in a farmhash??.cc file that are meant to be called |
| 24 | from farmhash.cc should not have "STATIC_INLINE" on their definiton, |
| 25 | and their definition should begin with a single line that includes the |
| 26 | arg list and ends with "{". |
| 27 | |
| 28 | 1. All hash functions in a farmhash??.cc that are conditionally |
| 29 | compiled should work under the same set of conditions (e.g., |
| 30 | can_use_aesni && can_use_sse42). The condition should be made obvious |
| 31 | at the top of the file, and if the requirements aren't met then dummy |
| 32 | versions should be provided, with each dummy's body starting with |
| 33 | FARMHASH_DIE_IF_MISCONFIGURED. It's easiest to work from a copy of an |
| 34 | existing file. |
| 35 | |
| 36 | 2. SELFTESTHash32 and similar must have 2 lines and must only use "len" |
| 37 | once per line. |
| 38 | |
| 39 | 3. farmhash??.cc can depend on any other farmhash??.cc, as long as |
| 40 | the dependency graph is acyclic. |
| 41 | |
| 42 | 4. Macros defined in a farmhash??.cc file should generally be #undef |
| 43 | before and/or after use, to reduce the chance of running into weird |
| 44 | errors. The code in farmhash??.cc will end up in ../src/farmhash.cc, |
| 45 | not in a header file, so you don't have to worry too much about |
| 46 | messing up macro defintions that later code will require. |