@@ -12,6 +12,10 @@ inputs:
12
12
description : ' Enable RAFT support.'
13
13
required : false
14
14
default : OFF
15
+ rocm :
16
+ description : ' Enable ROCm support.'
17
+ required : false
18
+ default : OFF
15
19
runs :
16
20
using : composite
17
21
steps :
38
42
# install base packages for X86_64
39
43
if [ "${{ runner.arch }}" = "X64" ]; then
40
44
# TODO: unpin versions for gxx_linux-64 and sysroot_linux-64 and merge it with ARM64 below
41
- conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28
45
+ if [ "${{ inputs.rocm }}" = "ON" ]; then
46
+ conda install -y -q -c conda-forge gxx_linux-64 sysroot_linux-64
47
+ else
48
+ conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28
49
+ fi
42
50
conda install -y -q mkl=2023 mkl-devel=2023
43
51
fi
44
52
60
68
else
61
69
conda install -y -q pytorch -c pytorch
62
70
fi
71
+ - name : ROCm - Install dependencies
72
+ if : inputs.rocm == 'ON'
73
+ shell : bash
74
+ run : |
75
+ # Update repos and install kmod, wget
76
+ sudo apt-get update
77
+ sudo apt-get install -y kmod wget
78
+
79
+ # Get UBUNTU version name
80
+ UBUNTU_VERSION_NAME=`cat /etc/os-release | grep UBUNTU_CODENAME | awk -F= '{print $2}'`
81
+
82
+ # Set ROCm version
83
+ ROCM_VERSION="6.1.1"
84
+
85
+ # Download, prepare, and install the package signing key
86
+ mkdir --parents --mode=0755 /etc/apt/keyrings
87
+ wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
88
+
89
+ # Add rocm repository
90
+ wget -qO - http://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
91
+ rocm_baseurl="http://repo.radeon.com/rocm/apt/${ROCM_VERSION}"
92
+ echo "deb [arch=amd64] ${rocm_baseurl} ${UBUNTU_VERSION_NAME} main" | sudo tee /etc/apt/sources.list.d/rocm.list
93
+ sudo apt-get update --allow-insecure-repositories
94
+ sudo apt-get install -y --allow-unauthenticated \
95
+ "rocm-dev${ROCM_VERSION}" "rocm-utils${ROCM_VERSION}" "rocm-libs${ROCM_VERSION}"
96
+
97
+ # Fake presence of MI200-class accelerators
98
+ echo "gfx90a" | sudo tee /opt/rocm/bin/target.lst
99
+
100
+ # Cleanup
101
+ sudo apt-get autoclean && sudo apt-get clean
102
+ sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
103
+
104
+ # symblink system libraries for HIP compiler
105
+ sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6
106
+ sudo ln -s /lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libc_nonshared.a
107
+ sudo ln -s /usr/lib/x86_64-linux-gnu/libpthread.so.0 /lib64/libpthread.so.0
108
+ sudo ln -s /home/runner/miniconda3/x86_64-conda-linux-gnu/sysroot/usr/lib64/libpthread_nonshared.a /usr/lib64/libpthread_nonshared.a
109
+ - name : ROCm - Hipify
110
+ if : inputs.rocm == 'ON'
111
+ shell : bash
112
+ run : ./faiss/gpu/hipify.sh
63
113
- name : Build all targets
64
114
shell : bash
65
115
run : |
70
120
-DBUILD_SHARED_LIBS=ON \
71
121
-DFAISS_ENABLE_GPU=${{ inputs.gpu }} \
72
122
-DFAISS_ENABLE_RAFT=${{ inputs.raft }} \
123
+ -DFAISS_ENABLE_ROCM=${{ inputs.rocm }} \
73
124
-DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \
74
125
-DFAISS_ENABLE_C_API=ON \
75
126
-DPYTHON_EXECUTABLE=$CONDA/bin/python \
79
130
.
80
131
make -k -C build -j$(nproc)
81
132
- name : C++ tests
133
+ if : inputs.rocm == 'OFF'
82
134
shell : bash
83
135
run : |
84
136
export GTEST_OUTPUT="xml:$(realpath .)/test-results/googletest/"
95
147
pytest --junitxml=test-results/pytest/results.xml tests/test_*.py
96
148
pytest --junitxml=test-results/pytest/results-torch.xml tests/torch_*.py
97
149
- name : Python tests (CPU + GPU)
98
- if : inputs.gpu == 'ON'
150
+ if : inputs.gpu == 'ON' && inputs.rocm == 'OFF'
99
151
shell : bash
100
152
run : |
101
153
pytest --junitxml=test-results/pytest/results.xml tests/test_*.py
@@ -110,6 +162,7 @@ runs:
110
162
FAISS_DISABLE_CPU_FEATURES=AVX2 LD_DEBUG=libs $CONDA/bin/python -c "import faiss" 2>&1 | grep faiss.so
111
163
LD_DEBUG=libs $CONDA/bin/python -c "import faiss" 2>&1 | grep faiss_avx2.so
112
164
- name : Upload test results
165
+ if : inputs.rocm == 'OFF'
113
166
uses : actions/upload-artifact@v4
114
167
with :
115
168
name : test-results-${{ runner.arch }}-${{ inputs.opt_level }}-${{ inputs.gpu }}-${{ inputs.raft }}
0 commit comments