Skip to content

Commit

Permalink
Fix swig osx (#3357)
Browse files Browse the repository at this point in the history
Summary:
The osx failed

https://app.circleci.com/pipelines/github/facebookresearch/faiss/5698/workflows/4e029c32-8d8b-4db7-99e2-8e802aad6653/jobs/32701

Pull Request resolved: #3357

Reviewed By: kuarora

Differential Revision: D56039739

Pulled By: junjieqi

fbshipit-source-id: dd434a8817148364797eae39c09e0e1e9edbe858
  • Loading branch information
junjieqi authored and facebook-github-bot committed Apr 25, 2024
1 parent 03750f5 commit bd22c93
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions faiss/python/swigfaiss.swig
Expand Up @@ -1022,14 +1022,17 @@ PyObject *swig_ptr (PyObject *a)
return SWIG_NewPointerObj(data, SWIGTYPE_p_bool, 0);
}
if(PyArray_TYPE(ao) == NPY_UINT64) {
#if (__SIZEOF_LONG__ == 8)
// Convert npy64 either long or long long and it depends on how compiler define int64_t.
// In the 64bit machine, typically the int64_t should be long but it is not hold for Apple osx.
// In this case, we want to convert npy64 to long_Long in osx
#if __SIZEOF_LONG__ == 8 && !defined(__APPLE__)
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long, 0);
#else
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long_long, 0);
#endif
}
if(PyArray_TYPE(ao) == NPY_INT64) {
#if (__SIZEOF_LONG__ == 8)
#if __SIZEOF_LONG__ == 8 && !defined(__APPLE__)
return SWIG_NewPointerObj(data, SWIGTYPE_p_long, 0);
#else
return SWIG_NewPointerObj(data, SWIGTYPE_p_long_long, 0);
Expand All @@ -1054,11 +1057,8 @@ struct PythonInterruptCallback: faiss::InterruptCallback {
}

};


%}


%init %{
/* needed, else crash at runtime */
import_array();
Expand Down Expand Up @@ -1121,15 +1121,8 @@ int * cast_integer_to_int_ptr (int64_t x) {
void * cast_integer_to_void_ptr (int64_t x) {
return (void*)x;
}

%}







%inline %{
void wait() {
// in gdb, use return to get out of this function
Expand Down

0 comments on commit bd22c93

Please sign in to comment.