forked from facebookresearch/faiss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-io-backward-compatibility.yml
More file actions
155 lines (134 loc) · 4.78 KB
/
index-io-backward-compatibility.yml
File metadata and controls
155 lines (134 loc) · 4.78 KB
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
name: Index serialization backward compatibility test
on:
workflow_call:
env:
OMP_NUM_THREADS: '10'
MKL_THREADING_LAYER: GNU
jobs:
# Scenario 1: CMake writes files, then Conda reads them
cmake-write-conda-read:
name: CMake Write -> Conda Read
runs-on: ubuntu-latest
env:
# run_id does not change if we re-run the job, so this is safe for
# the partway-failure-rerun scenario.
SHARED_DATA_DIR: /tmp/faiss-serialization-backward-compatibility-${{ github.run_id }}-cmake-write
steps:
- name: Checkout
uses: actions/checkout@v4
# Step 1: Build with CMake and write files
- name: Build with CMake
uses: ./.github/actions/build_cmake
with:
upload_artifacts: 'false'
- name: Create shared data directory
shell: bash
run: |
mkdir -p ${{ env.SHARED_DATA_DIR }}
chmod 777 ${{ env.SHARED_DATA_DIR }}
- name: Run CMake writer (write Faiss index and metadata)
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate
$CONDA/bin/python tests/index_io_backward_compatibility/cmake_writer.py ${{ env.SHARED_DATA_DIR }}
- name: Verify files were written
shell: bash
run: |
echo "Files created by CMake build:"
ls -lh ${{ env.SHARED_DATA_DIR }}
# Step 2: Install conda faiss-cpu and read files
- name: Clean cmake-built packages
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate
# Remove packages that conflict with faiss-cpu
conda remove -y numpy scipy pytest gflags swig cmake make mkl mkl-devel || true
- name: Install faiss-cpu from pytorch channel
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate
conda list
conda install -y -c pytorch faiss-cpu=1.13.1
conda list
- name: Run Conda reader (read Faiss index and verify)
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate
python tests/index_io_backward_compatibility/conda_reader.py ${{ env.SHARED_DATA_DIR }}
- name: Upload artifacts from cmake->conda test
if: always()
uses: actions/upload-artifact@v4
with:
name: cmake-write-conda-read-data
path: ${{ env.SHARED_DATA_DIR }}
# Scenario 2: Conda writes files, then CMake reads them
conda-write-cmake-read:
name: Conda Write -> CMake Read
runs-on: ubuntu-latest
env:
SHARED_DATA_DIR: /tmp/faiss-serialization-backward-compatibility-${{ github.run_id }}-conda-write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
# Step 1: Install conda faiss-cpu package and write files
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
miniforge-version: latest
- name: Install faiss-cpu from pytorch channel
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate
# Install pre-built faiss-cpu
conda install -y -c pytorch faiss-cpu=1.13.1
conda list
- name: Create shared data directory
shell: bash
run: |
mkdir -p ${{ env.SHARED_DATA_DIR }}
chmod 777 ${{ env.SHARED_DATA_DIR }}
- name: Run Conda writer (write Faiss index and metadata)
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate
python tests/index_io_backward_compatibility/conda_writer.py ${{ env.SHARED_DATA_DIR }}
- name: Verify files were written
shell: bash
run: |
echo "Files created by Conda build:"
ls -lh ${{ env.SHARED_DATA_DIR }}
# Step 2: Rebuild with CMake and read files
- name: Clean conda artifacts
shell: bash
run: |
# Uninstall conda-built faiss to avoid conflicts
eval "$(conda shell.bash hook)"
conda activate
conda uninstall -y faiss-cpu || true
- name: Build with CMake
uses: ./.github/actions/build_cmake
with:
setup_conda: 'false'
upload_artifacts: 'false'
- name: Run CMake reader (read Faiss index and verify)
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate
$CONDA/bin/python tests/index_io_backward_compatibility/cmake_reader.py ${{ env.SHARED_DATA_DIR }}
- name: Upload artifacts from conda->cmake test
if: always()
uses: actions/upload-artifact@v4
with:
name: conda-write-cmake-read-data
path: ${{ env.SHARED_DATA_DIR }}