{"id":18391744,"url":"https://github.com/moscicky/faissnama","last_synced_at":"2025-07-10T11:08:56.681Z","repository":{"id":83328311,"uuid":"600501543","full_name":"moscicky/faissnama","owner":"moscicky","description":"Project Panama with Faiss","archived":false,"fork":false,"pushed_at":"2023-06-20T07:51:49.000Z","size":12,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-02T06:07:18.115Z","etag":null,"topics":["faiss","java","jdk19","panama","project-panama"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moscicky.png","metadata":{"files":{"readme":"readme.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-11T17:32:30.000Z","updated_at":"2025-02-09T18:59:50.000Z","dependencies_parsed_at":"2024-11-06T02:02:34.619Z","dependency_job_id":"a82ff8df-4e68-4772-82ed-ddadfd02ac3d","html_url":"https://github.com/moscicky/faissnama","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/moscicky/faissnama","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moscicky%2Ffaissnama","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moscicky%2Ffaissnama/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moscicky%2Ffaissnama/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moscicky%2Ffaissnama/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moscicky","download_url":"https://codeload.github.com/moscicky/faissnama/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moscicky%2Ffaissnama/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264569449,"owners_count":23629602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["faiss","java","jdk19","panama","project-panama"],"created_at":"2024-11-06T01:53:08.261Z","updated_at":"2025-07-10T11:08:56.382Z","avatar_url":"https://github.com/moscicky.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Faissnama\n\nThis project shows how new `java.foreign` API (project Panama) can be used to \ncall C/C++ library - Faiss - from Java.\n\n## Step 1 - build \u0026 install faiss\n\n1. Download faiss\n\n    MacOS and Ubuntu:\n    ```shell\n    git clone https://github.com/facebookresearch/faiss.git\n    cd faiss\n    ```\n\n2. Install dependencies\n\n    MacOS:\n    ```shell\n    brew install libomp\n    ```\n   \n    Ubuntu:\n    ```shell\n    sudo apt-get install libomp-dev libblas-dev liblapack-dev\n    sudo snap install cmake --classic # the version in apt is too old\n    ```\n\n3. Create build configuration\n\n    MacOS:\n    ```shell\n    cmake -B build \\\n    -DFAISS_ENABLE_GPU=OFF \\\n    -DFAISS_ENABLE_PYTHON=OFF \\\n    -DBUILD_TESTING=OFF \\\n    -DBUILD_SHARED_LIBS=ON \\\n    -DCMAKE_BUILD_TYPE=Release \\\n    -DFAISS_OPT_LEVEL=avx2 \\\n    -DFAISS_ENABLE_C_API=ON \\\n    -DOpenMP_C_FLAGS=-fopenmp=lomp \\\n    -DOpenMP_CXX_FLAGS=-fopenmp=lomp \\\n    -DOpenMP_C_LIB_NAMES=\"libomp\" -DOpenMP_CXX_LIB_NAMES=\"libomp\" \\\n    -DOpenMP_libomp_LIBRARY=\"/opt/homebrew/opt/libomp/lib/libomp.dylib\" \\\n    -DOpenMP_CXX_FLAGS=\"-Xpreprocessor -fopenmp /opt/homebrew/opt/libomp/lib/libomp.dylib \\\n    -I/opt/homebrew/opt/libomp/include\" -DOpenMP_CXX_LIB_NAMES=\"libomp\" \\\n    -DOpenMP_C_FLAGS=\"-Xpreprocessor -fopenmp  --I/opt/homebrew/opt/libomp/include\"\n    .\n    ```\n\n    Ubuntu:\n    ```shell\n    cmake . -B build \\\n    -DFAISS_ENABLE_GPU=OFF \\\n    -DFAISS_ENABLE_PYTHON=OFF \\\n    -DFAISS_OPT_LEVEL=avx2 \\\n    -DFAISS_ENABLE_C_API=ON \\\n    -DBUILD_SHARED_LIBS=ON    \n    ```\n   \n4. Build faiss\n\n    MacOS and Ubuntu:\n    ```shell\n    cmake --build build --config Release -j\n    ```\n\n5. build \u0026 install faiss C API\n\n    MacOS:\n    ```shell\n    cd build/c_api \u0026\u0026 make \u0026\u0026 sudo make install\n    sudo cp libfaiss_c.dylib /usr/local/lib/  \n    ```\n   \n    Ubuntu:\n    ```shell\n    cd build/c_api \u0026\u0026 make \u0026\u0026 sudo make install\n    sudo cp libfaiss_c.so /usr/local/lib/  \n    ```\n\n## Step 2 - generate C bindings\n\n1. Download \u0026 extract jextract\n\n    MacOS:\n    ```shell\n    wget https://download.java.net/java/early_access/jextract/1/openjdk-20-jextract+1-2_macos-x64_bin.tar.gz\n    \u0026\u0026 tar -xzf openjdk-20-jextract+1-2_macos-x64_bin.tar.gz\n    ```\n   \n    Ubuntu:\n    ```shell\n    wget https://download.java.net/java/early_access/jextract/1/openjdk-20-jextract+1-2_linux-x64_bin.tar.gz\n    \u0026\u0026 tar -xzf openjdk-20-jextract+1-2_linux-x64_bin.tar.gz\n    ```\n\n2. Generate faiss C bindings (they will be created in `faiss` directory)\n\n    MacOS:\n    ```shell\n    cd scripts \u0026\u0026 ./create_bindings.sh\n    ```\n\n    Ubuntu:\n    ```shell\n    cd scripts \u0026\u0026 ./create_bindings_ubuntu.sh\n    ```\n\n### Reference\n\n- https://github.com/carldea/panama4newbies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoscicky%2Ffaissnama","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoscicky%2Ffaissnama","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoscicky%2Ffaissnama/lists"}