Add option to use 64-bit rapidhash for MacOS build#104
Add option to use 64-bit rapidhash for MacOS build#104
Conversation
Uses 64-bit rapidhash implementation instead of 128-bit spookyhash. For playing around on a Mac laptop, this should be fine. Sets up spookyhash or rapidhash based on whether the command `uname -s` outputs 'Darwin' (the MacOS kernal).
|
Thanks for this improvement. I have tried to install the package in a MacOS which ends up with the following errors, In [1]: import pyci
-------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pyci
File /xxxx/xxxxx/tmp_py311/lib/python3.11/site-packages/pyci/__init__.py:18
1 # This file is part of PyCI.
2 #
3 # PyCI is free software: you can redistribute it and/or modify it under
(...)
13 # You should have received a copy of the GNU General Public License
14 # along with PyCI. If not, see <http://www.gnu.org/licenses/>.
16 r"""PyCI module."""
---> 18 from pyci._pyci import __version__, c_long, c_ulong, c_double
19 from pyci._pyci import secondquant_op, wavefunction, one_spin_wfn, two_spin_wfn
20 from pyci._pyci import doci_wfn, fullci_wfn, genci_wfn, sparse_op
ModuleNotFoundError: No module named 'pyci._pyci'The package was installed with |
|
Ok, this seems to be a problem with file paths. It must need to be installed to different directory, or with a different file extension, for it to work. Although it seems to compile now, which is the hard part. |
|
Can you try renaming the .so file to .dylib and trying again? |
|
I don't fully understand what you mean by Following your suggestions of renaming .so to .dylib, but I was not able to find any .so file from the source or the installed codes. Can you provide more explanations? Thanks. |
|
The instruction say to run |
|
yes, I just did that. Currently, I got errors when running c++ -std=c++14 -Wall -Wextra -pipe -O3 -fPIC -flto=auto -fvisibility=hidden -pthread -Ipyci/include -Ixxxx/tmp_py311/include/python3.11 -Ixxxx/tmp_py311/lib/python3.11/site-packages/numpy/_core/include -Ideps/eigen -Ideps/spectra/include -Ideps/parallel-hashmap -Ideps/pybind11/include -undefined dynamic_lookup -D_PYCI_VERSION='0.6.1' -D_GIT_BRANCH='rapidhash_macos' -D_BUILD_TIME='2025-03-07 18:15:43' -D_COMPILER_VERSION='Apple clang version 16.0.0 (clang-1600.0.26.6)' -D_USE_RAPIDHASH='1' -c pyci/src/SpookyV2.cpp -o pyci/src/SpookyV2.o
clang++: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
c++ -std=c++14 -Wall -Wextra -pipe -O3 -fPIC -flto=auto -fvisibility=hidden -pthread -Ipyci/include -Ixxxx/tmp_py311/include/python3.11 -Ixxxx/tmp_py311/lib/python3.11/site-packages/numpy/_core/include -Ideps/eigen -Ideps/spectra/include -Ideps/parallel-hashmap -Ideps/pybind11/include -undefined dynamic_lookup -D_PYCI_VERSION='0.6.1' -D_GIT_BRANCH='rapidhash_macos' -D_BUILD_TIME='2025-03-07 18:15:43' -D_COMPILER_VERSION='Apple clang version 16.0.0 (clang-1600.0.26.6)' -D_USE_RAPIDHASH='1' -c pyci/src/ap1rog.cpp -o pyci/src/ap1rog.o
clang++: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
In file included from pyci/src/ap1rog.cpp:16:
pyci/include/pyci.h:45:10: fatal error: 'rapidhash.h' file not found
45 | #include <rapidhash.h>
| ^~~~~~~~~~~~~
1 error generated.
make: *** [pyci/src/ap1rog.o] Error 1 |
|
Yep, the rapid has directory needs to be specified in the Makefile with the
-I flag. I must have missed it. I can fix it tonight.
…On Fri, Mar 7, 2025, 13:18 Fanwang Meng ***@***.***> wrote:
yes, I just did that. Currently, I got errors when running make. I tried
to install rapidhash manually, but didn't figure out a solution. Any
suggestions on how to address the issue? Thanks.
c++ -std=c++14 -Wall -Wextra -pipe -O3 -fPIC -flto=auto -fvisibility=hidden -pthread -Ipyci/include -Ixxxx/tmp_py311/include/python3.11 -Ixxxx/tmp_py311/lib/python3.11/site-packages/numpy/_core/include -Ideps/eigen -Ideps/spectra/include -Ideps/parallel-hashmap -Ideps/pybind11/include -undefined dynamic_lookup -D_PYCI_VERSION='0.6.1' -D_GIT_BRANCH='rapidhash_macos' -D_BUILD_TIME='2025-03-07 18:15:43' -D_COMPILER_VERSION='Apple clang version 16.0.0 (clang-1600.0.26.6)' -D_USE_RAPIDHASH='1' -c pyci/src/SpookyV2.cpp -o pyci/src/SpookyV2.o
clang++: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
c++ -std=c++14 -Wall -Wextra -pipe -O3 -fPIC -flto=auto -fvisibility=hidden -pthread -Ipyci/include -Ixxxx/tmp_py311/include/python3.11 -Ixxxx/tmp_py311/lib/python3.11/site-packages/numpy/_core/include -Ideps/eigen -Ideps/spectra/include -Ideps/parallel-hashmap -Ideps/pybind11/include -undefined dynamic_lookup -D_PYCI_VERSION='0.6.1' -D_GIT_BRANCH='rapidhash_macos' -D_BUILD_TIME='2025-03-07 18:15:43' -D_COMPILER_VERSION='Apple clang version 16.0.0 (clang-1600.0.26.6)' -D_USE_RAPIDHASH='1' -c pyci/src/ap1rog.cpp -o pyci/src/ap1rog.o
clang++: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
In file included from pyci/src/ap1rog.cpp:16:
pyci/include/pyci.h:45:10: fatal error: 'rapidhash.h' file not found
45 | #include <rapidhash.h>
| ^~~~~~~~~~~~~
1 error generated.
make: *** [pyci/src/ap1rog.o] Error 1
—
Reply to this email directly, view it on GitHub
<#104 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLODOS3KU3WGKVDZTYLOZL2THPJDAVCNFSM6AAAAABYOZ7MTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBXGEYDKMJQHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: FanwangM]*FanwangM* left a comment (theochem/PyCI#104)
<#104 (comment)>
yes, I just did that. Currently, I got errors when running make. I tried
to install rapidhash manually, but didn't figure out a solution. Any
suggestions on how to address the issue? Thanks.
c++ -std=c++14 -Wall -Wextra -pipe -O3 -fPIC -flto=auto -fvisibility=hidden -pthread -Ipyci/include -Ixxxx/tmp_py311/include/python3.11 -Ixxxx/tmp_py311/lib/python3.11/site-packages/numpy/_core/include -Ideps/eigen -Ideps/spectra/include -Ideps/parallel-hashmap -Ideps/pybind11/include -undefined dynamic_lookup -D_PYCI_VERSION='0.6.1' -D_GIT_BRANCH='rapidhash_macos' -D_BUILD_TIME='2025-03-07 18:15:43' -D_COMPILER_VERSION='Apple clang version 16.0.0 (clang-1600.0.26.6)' -D_USE_RAPIDHASH='1' -c pyci/src/SpookyV2.cpp -o pyci/src/SpookyV2.o
clang++: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
c++ -std=c++14 -Wall -Wextra -pipe -O3 -fPIC -flto=auto -fvisibility=hidden -pthread -Ipyci/include -Ixxxx/tmp_py311/include/python3.11 -Ixxxx/tmp_py311/lib/python3.11/site-packages/numpy/_core/include -Ideps/eigen -Ideps/spectra/include -Ideps/parallel-hashmap -Ideps/pybind11/include -undefined dynamic_lookup -D_PYCI_VERSION='0.6.1' -D_GIT_BRANCH='rapidhash_macos' -D_BUILD_TIME='2025-03-07 18:15:43' -D_COMPILER_VERSION='Apple clang version 16.0.0 (clang-1600.0.26.6)' -D_USE_RAPIDHASH='1' -c pyci/src/ap1rog.cpp -o pyci/src/ap1rog.o
clang++: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
In file included from pyci/src/ap1rog.cpp:16:
pyci/include/pyci.h:45:10: fatal error: 'rapidhash.h' file not found
45 | #include <rapidhash.h>
| ^~~~~~~~~~~~~
1 error generated.
make: *** [pyci/src/ap1rog.o] Error 1
—
Reply to this email directly, view it on GitHub
<#104 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLODOS3KU3WGKVDZTYLOZL2THPJDAVCNFSM6AAAAABYOZ7MTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBXGEYDKMJQHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
OK, it should build now. Can you try the latest commit, and then if not, by renaming the .so->.dylib? |
|
Still got errors when run /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sort.h:51:1: note: candidate template ignored: substitution failure [with _AlgPolicy = std::_ClassicAlgPolicy, _Compare = std::__less<void, void> &, _ForwardIterator = std::sort_with_arg::value_iterator_t<double, long>]
51 | __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, _Compare __c) {
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sort.h:92:7: error: no matching function for call to object of type 'std::__less<void, void>'
92 | if (__c(*__x4, *__x3)) {
| ^~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/comp.h:40:60: note: candidate template ignored: substitution failure [with _Tp = value_reference_t<double, long>, _Up = value_reference_t<double, long>]
40 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __lhs, const _Up& __rhs) const {
| ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [pyci/src/sparseop.o] Error 1 |
|
Okay, I can't debug it over messages, I really need access to a Mac or someone with a Mac and proficiency in C++. It might be an issue with the CFLAGS in the Makefile, but I'd have to play around with them. Thanks for trying, though. |
|
I've made another commit that might work. @RichRick1 would you also mind trying this? |
|
So I basically have the same error that @FanwangM has Here is a make file However now it doesn't see the the pyci library now The error I get is >>> import pyci |
|
I think the extension for the C library should be different on different platforms. I made it so that Mac OSes build a .dylib file... maybe that doesn't work though. I'm not sure. |
Uses 64-bit rapidhash implementation instead of 128-bit spookyhash. For playing around on a Mac laptop, this should be fine.
Sets up spookyhash or rapidhash based on whether the command
uname -soutputs 'Darwin' (the MacOS kernel).