-
Notifications
You must be signed in to change notification settings - Fork 30
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
Oxpy & oat not working on M1 Mac #31
Comments
Thanks for the report! What happens if you run the oxpy example by hand?
|
The same error:
On the previous Linux-Ubuntu OS I have never experienced such errors. |
Thanks! This means that the issue is definitely caused by oxpy. Unfortunately I don't have access to an M1-powered mac computer, but I'll ask around and see if I can borrow one. |
Thanks in advance! I was pretty confident it was oxpy, because oxDNA works well. |
Just a quick supplement: I think that all the problems originate from the first lines of the
It seems that MARCH is not supporter by |
This shouldn't be an issue: cmake checks whether the flag is supported and if it's not (as in this case) then it doesn't use it. |
Hi, This might be a In your
My guess is you will get something similar to Then, in your system python, usually it is
My guess is you will get something similar to If this is the case, you can either create an virtual env with your system's python, or just use it (not that recommended). Or, better reinstall your conda, and pay EXTRA attention to install the arm64 version. After that, repeat the whole installation process from scratch, meaning, create new virtual env with the newly installed conda and see. |
Thanks for the response Roden! These are the outputs for the two commands:
|
Then, this is not the case. Sorry... |
I experimented a bit with an M1 from my colleague and realized that I cannot enable Debug mode and oxpy together...
If I remove
I reached to this screenshot: The beginning part of the call stack: All assembly... I know it failed immediately at Line4 of run.py ( I think one way forward is to figure out how to have the debug info enabled for oxpy, which I'm really not sure.. |
Roden, thanks for trying. You can use the |
Thank you both! While trying to fix this just a silly request/idea: because I usually run simulations "by hand" or by using shell scripts and I'm not planning to use |
That's a question for @ErikPoppleton ! |
Hi Simone, The last version of |
One other thing to try, if you to go the oxDNA source directory and try installing
Does that fix the segmentation fault? |
Hi Erik, Thanks for the alternative! Yes it would be nice to try to fix Following your hint inside the conda env doesn't fix the problem and |
Some work-in-progress.
I tried all the following hoping to get into the oxpy source code:
I'm not really sure where to go from here to get more efficient debugging. The worst case might be a few std::cout line-by-line... |
Finally, I met this issue in pybind11 (on my Intel Mac with the newest pybind11). Ultimately, in the newest version of pybind11, the following code section cannot run through.
The comment says "Ensure that the GIL is held". It means somehow in oxpy, the GIL is not held. |
For more about the debugging process, please see pybind11 issue #3801. @simonecodispoti Could you please make the following change, re-cmake (remove the build folder first), and then recompile and see? Line 26 in ec1be2b
↓ TARGET_LINK_LIBRARIES(_oxpy_lib common) |
Hey Roden, my last commit (e003f6c) makes it possible to compile oxpy with -DDebug=True. I hope this help, and thanks for all the effort you are putting into this. I hope I'll be able to try to debug it myself as soon as possible. |
So, the change I mentioned previously (remove As for the debugging process, somehow before I sleep yesterday, after reopening vscode or something I realized that I could step into Pybind11 itself is a header-only library, then, my guess is there might be something missing in the CMake files in the oxDNA's pybind11. But I haven't checked it yet. |
I was using codelldb in VS Code. Because gdb is not available on M1. I have not tested gdb on Ubuntu though. |
Thanks a lot @RodenLuo ! You are really putting a lot of effort into this and I'm really glad of that.
Unfortunately this only fixes I will also try the old version of oxdna tools if necessary. |
It's working on the M1 I'm testing now. The machine is Click me to see the whole log# ======= version checking
$ file /Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/bin/python
/Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/bin/python: Mach-O 64-bit executable arm64
$ /Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/bin/python -V
Python 3.10.4
$ /Applications/CMake.app/Contents/bin/cmake -version
cmake version 3.24.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
# ======= download and edit
$ git clone https://github.com/lorenzo-rovigatti/oxDNA.git
$ vi oxDNA/oxpy/CMakeLists.txt # remove the linking as mentioned above
# ======= install
$ /Applications/CMake.app/Contents/bin/cmake .. -DDebug=True -DPython=ON -DPYTHON_INCLUDE_DIRS=/Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/include/python3.10 -DPYTHON_EXECUTABLE=/Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/bin/python
CMake Deprecation Warning at CMakeLists.txt:8 (cmake_policy):
The OLD behavior for policy CMP0037 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- The C compiler identification is AppleClang 13.0.0.13000027
-- The CXX compiler identification is AppleClang 13.0.0.13000027
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Compiling in Debug mode
-- Found Git: /opt/homebrew/bin/git (found version "2.37.3")
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Adding the targets found in the /Users/yangx0i/roden/oxDNA/contrib/randisi folder
-- Adding the targets found in the /Users/yangx0i/roden/oxDNA/contrib/romano folder
-- Adding the targets found in the /Users/yangx0i/roden/oxDNA/contrib/rovigatti folder
-- Found PkgConfig: /opt/homebrew/bin/pkg-config (found version "0.29.2")
-- Checking for module 'gsl'
-- No package 'gsl' found
-- Adding the targets found in the /Users/yangx0i/roden/oxDNA/contrib/tostiguerra folder
-- Found PythonInterp: /Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/bin/python (found suitable version "3.10.4", minimum required is "3")
-- Found PythonLibs: /Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/lib/libpython3.10.dylib
-- pybind11 v2.2.4
-- The detected Python's include dirs are: /Users/yangx0i/miniconda3_arm64/envs/oxpy_arm/include/python3.10
-- Enabling Python bindings
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/yangx0i/roden/oxDNA/build
$ make -j98
$ make install
# ======= testing
$ ~/.local/bin/oat config
INFO: oxDNA_analysis_tools version: 2.0.3
INFO: running config.py installed at: /Users/yangx0i/.local/lib/python3.10/site-packages/oxDNA_analysis_tools/config.py
INFO: Python version: 3.10.4
INFO: Package Numpy found. Version: 1.23.3
INFO: Package MatPlotLib found. Version: 3.5.3
INFO: Package BioPython found. Version: 1.79
INFO: Package SciKit-Learn found. Version: 1.1.2
INFO: Package oxpy found. Version: 3.4.3.dev0+g6794178.d20220912
INFO: No dependency issues found.
INFO: Analyses will be computed in chunks of 20 configurations at a time
INFO: You can modify this number by running oat config -n <number>, which will be persistent between analyses.
$ ~/.local/bin/oat mean -h
usage: mean.py [-h] [-p num_cpus] [-o output_file] [-d deviation_file]
[-i index_file] [-a alignment_configuration]
trajectory
Computes the mean structure of a trajectory file
positional arguments:
trajectory The trajectory file you wish to analyze
options:
-h, --help show this help message and exit
-p num_cpus (optional) How many cores to use
-o output_file, --output output_file
The filename to save the mean structure to
-d deviation_file, --deviations deviation_file
Immediatley run oat deviations from the output
-i index_file Compute mean structure of a subset of particles from a
space-separated list in the provided file
-a alignment_configuration, --align alignment_configuration
The id of the configuration to align to, otherwise
random
$ ~/.local/bin/oat mean -o mean_all.dat hairpin.conf
INFO: oxDNA_analysis_tools version: 2.0.3
INFO: running config.py installed at: /Users/yangx0i/.local/lib/python3.10/site-packages/oxDNA_analysis_tools/config.py
INFO: Python version: 3.10.4
INFO: Package Numpy found. Version: 1.23.3
INFO: No dependency issues found.
INFO: Processing in blocks of 20 configurations
INFO: You can modify this number by running oat config -n <number>, which will be persistent between analyses.
Starting up 1 processes for 1 chunks
All spawned, waiting for results
--- 0.6535718441009521 seconds --- @lorenzo-rovigatti Hi Lorenzo, Using |
Thanks @RodenLuo ! I will try with a clean installation and following your log. Do I have to install |
You are very welcome! You don't have to do any extra stuff for |
I Tried again and now one of the 2 tests of |
Removing the linking of the python libs seems to make it possible to compile oxpy on M1 CPUs (see #31).
Thank you very much Roden. I still haven't found the time to get my hands dirty with this, but I have committed the change you suggested (removing the linking of python libs). |
Actually I tried with another trajectory and is running, although very slowly. I think I found the issue: the trajectories I was using were without momenta ( |
Hi Lorenzo, Thanks. I just got interested in stepping into the code to learn more as only recently do I start to understand the code base, even though very superficially in many places. Feel free to handle it at your convenience. Hi Simone, I tested on two slightly larger trajectories and they could run through (but with some differences in the resulting files compared to the run on my ubuntu). The structure has 16128 NTs. Both trajectories have 100 recorded confs (100 I also have one > diff last_nucleotide.dat last_nucleotide_correct.dat
2,10c2,10
< 8.914564 -0.061766 1.133814
< 8.856179 0.137832 1.160710
< 8.765789 0.300055 1.090000
< 8.824286 0.355273 1.063431
< 8.824516 0.386833 1.077637
< 8.757490 0.452182 1.008346
< 8.983339 0.367106 0.999174
< 8.984770 0.363439 0.864591
< 8.886357 0.530297 0.921013
---
> 8.915883 -0.061127 1.132751
> 8.858563 0.138343 1.159861
> 8.816379 0.295659 1.044456
> 8.881306 0.325018 1.010187
> 8.910014 0.357738 1.016579
> 8.942146 0.304912 0.892514
> 9.069714 0.302830 0.841750
> 9.154019 0.356858 0.754155
> 9.164492 0.493286 0.788510 Basically, in that folder, the failed test requires the run of |
@simonecodispoti I've reproduced your error with |
@zoombya It's slightly more subtle than that. The trajectory parser is breaking because it's looking for a space character after the a3 vector to split it from the momenta, but when |
There are two possible resolutions to this:
|
Hi all! From the |
Side note on the original topic, I helped somebody get started with the software (without oxpy) on an M1 Mac yesterday and everything worked smoothly. |
That's great to know! Can I mark it as resolved? |
Any final thoughts on the side discussion this spawned over |
Great to know! I didn't face the issue here as I never used |
Just one last thing! Everything seems to work nicely with the exception of the
I get the following traceback of errors:
The Thanks, this should be the last fix |
Hi Simone, |
Hi, thanks Erik, with |
@simonecodispoti I cleaned up the clustering a bit, but couldn't reproduce your error with a toy system. If you're still running into this, could you please open up a new issue and include a small trajectory file which generates the error for you? |
Hi all,
I'm still having issues with
oxpy
andoat
, issues similar to those investigated here:sulcgroup/oxdna_analysis_tools#22
This time I'm working on macOS Monterey 12.5, with M1 architecture. I was able to compile and test successfully
oxDNA
butmake test_oxpy
was not passed and if I try to calloat config
this raises a brutal segmentation fault:As suggested I created a conda virtual enviroment with
python3.9
and the requested libraries and then compiled with:cmake .. -DPython=ON -DPYTHON_INCLUDE_DIRS=/Users/simo/opt/anaconda3/envs/oxdna/include/python3.9 -DPYTHON_EXECUTABLE=/Users/simo/opt/anaconda3/envs/oxdna/bin/python
I also tried without a virtual env (I use anaconda as package manager, the one developed for M1 arm architectures) and without specifying the path using only
-DOxpySystemInstall=On
, but this doesn't change anything.Thank you in advance,
Simone
P.S. The
cmake
log output on the console:The text was updated successfully, but these errors were encountered: