shubhamvishu commented on PR #15508:
URL: https://github.com/apache/lucene/pull/15508#issuecomment-3667003654

   To expand on what exactly a Lucene user would look like on their end to 
test/enable this :
   
   - **Compile** the C code (default impl or custom)
   
   ```sh
   // Linux/Unix
   gcc -shared -O3 -march=native -funroll-loops -o /home/simd/libdotProduct.so 
/home/apachelucene/lucene/misc/src/c/dotProduct.c
   
   // macOS
   gcc -shared -O3 -march=native -funroll-loops -o 
/home/simd/libdotProduct.dylib /home/apachelucene/lucene/misc/src/c/dotProduct.c
   
   // Windows
   gcc -shared -O3 -march=native -funroll-loops -o /home/simd/dotProduct.dll 
/home/apachelucene/lucene/misc/src/c/dotProduct.c
   ```
   ```c
   // dotProduct.c
   
   int32_t dot8s(int8_t vec1[], int8_t vec2[], int32_t limit) {
       // dot product impl
   }
   ```
   
   
   - **Test** if everything works and dot product implementation is correct
   
   ```sh
   ./gradlew test                                 // PASSES, since by default 
native dot product is not testes
   ./gradlew test -Ptest.native.dotProduct=false  // PASSES, switched off
   ./gradlew test \
     -Ptest.native.dotProduct=true \
     -Ptests.jvmargs="-Djava.library.path=/home/simd" // PASSES
   
   
   ./gradlew test -Ptest.native.dotProduct=true   // FAILS, needs library to be 
linked
   ```
   
   
   - **Benchmark** against the other C implementation or Panama
   
   ```sh
   java --enable-native-access=ALL-UNNAMED \
     --enable-preview \
     -Djava.library.path="/home/simd" \
     -jar 
lucene/benchmark-jmh/build/benchmarks/lucene-benchmark-jmh-11.0.0-SNAPSHOT.jar \
     regexp "binaryDotProductVector|dot8sNative"
    ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to