Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix faiss swig build with version > 4.2.x #3315

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ jobs:
- run:
name: Install env using main channel
command: |
conda install -y -q python=3.11 cmake make swig=4.0.2 mkl=2023 mkl-devel=2023 numpy scipy pytest gxx_linux-64 sysroot_linux-64
conda install -y -q python=3.11 cmake make swig mkl=2023 mkl-devel=2023 numpy scipy pytest gxx_linux-64=11.2 sysroot_linux-64
- when:
condition:
equal: [ "ON", << parameters.raft >> ]
steps:
- run:
name: Install env using conda-forge channel
command: |
conda install -y -q python=3.11 cmake make swig=4.0.2 mkl=2023 mkl-devel=2023 numpy scipy pytest gxx_linux-64 sysroot_linux-64=2.28 libraft cuda-version=11.8 cuda-toolkit -c rapidsai-nightly -c "nvidia/label/cuda-11.8.0" -c conda-forge
conda install -y -q python=3.11 cmake make swig mkl=2023 mkl-devel=2023 numpy scipy pytest gxx_linux-64=11.2 sysroot_linux-64=2.28 libraft cuda-version=11.8 cuda-toolkit -c rapidsai-nightly -c "nvidia/label/cuda-11.8.0" -c conda-forge
- when:
condition:
and:
Expand Down
2 changes: 1 addition & 1 deletion conda/faiss-gpu-raft/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ outputs:
build:
- {{ compiler('cxx') }}
- sysroot_linux-64 =2.17 # [linux64]
- swig =4.0.2
- swig
- cmake >=3.23.1
- make # [not win]
host:
Expand Down
12 changes: 6 additions & 6 deletions faiss/python/swigfaiss.swig
Original file line number Diff line number Diff line change
Expand Up @@ -1022,17 +1022,17 @@ PyObject *swig_ptr (PyObject *a)
return SWIG_NewPointerObj(data, SWIGTYPE_p_bool, 0);
}
if(PyArray_TYPE(ao) == NPY_UINT64) {
#ifdef SWIGWORDSIZE64
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long, 0);
#else
#if (__WORDSIZE == 32)
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long_long, 0);
#else
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably fail on windows and / or mac because sizeof(long) = 4 on these platforms. So there should be a way to differentiate between them.

#endif
}
if(PyArray_TYPE(ao) == NPY_INT64) {
#ifdef SWIGWORDSIZE64
return SWIG_NewPointerObj(data, SWIGTYPE_p_long, 0);
#if (__WORDSIZE == 32)
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long_long, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check on __SIZEOF_LONG__ and generate SWIGTYPE_p_long_long or SWIGTYPE_p_long, not unsigned types

#else
return SWIG_NewPointerObj(data, SWIGTYPE_p_long_long, 0);
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long, 0);
#endif
}
PyErr_SetString(PyExc_ValueError, "did not recognize array type");
Expand Down