simsopt icon indicating copy to clipboard operation
simsopt copied to clipboard

Illegal Instruction when initializing simsoptpp classes

Open mrtnkb opened this issue 2 years ago • 8 comments

Hi,

I'm trying to use simsopt 0.19.0 from pypi and get an Illegal Instruction error. (also seems to be the case with 0.18.1).

This is not an issue when using the official hiddensymmetries/simsopt docker container which seems to have simsopt version 0.19.0.post29+gb8c08d5d installed.

An example line which triggers the error is: https://github.com/hiddenSymmetries/simsopt/blob/b8c08d5dd2c4fc7a946af017a5545c9a61a5ed88/src/simsopt/geo/surfacerzfourier.py#L73

To reproduce:

docker run -it --rm continuumio/miniconda3

Then (bash inside docker):

conda create -n test -c conda-forge python==3.10.12
conda activate test
pip install simsopt==0.19.0
python3

Then (python):

from simsopt import geo
geo.SurfaceRZFourier()

Thanks!

mrtnkb avatar Sep 18 '23 08:09 mrtnkb

Thank you for raising your first issue!

I tried reproducing your error, but on my desktop everything runs correctly.

With an Instruction Error I can only think it has something to do with the processor, are you perhaps running on a newer Mac?

I believe @landreman has more experience with mac systems

smiet avatar Sep 19 '23 12:09 smiet

@mrtnkb Can you tell us exactly what hardware you are running on? @mbkumar is the guru to ask about installation and build issues like this. Typically "illegal instruction" means the compiled bits of simsopt were compiled assuming a specific processor architecture which differs from the one you are actually running on. If the precompiled binary from pypi gives this error on your system, you can try building from source (i.e. clone the repo and pip install .), or try the simsopt conda package.

landreman avatar Sep 22 '23 06:09 landreman

Hi @smiet not running on a Mac unfortunately. But if you run the steps in that docker on your machine you don't get the same failure?

Hi @landreman The host OS is Ubuntu 22.04.3 LTS and the CPU is 12th Gen Intel(R) Core(TM) i7-12700H

Building from source works, but it causing some pain in our CI setup to not be able to use the pypi compiled wheel.

Version 0.13.0 seems to be the most recent version which works fine

mrtnkb avatar Sep 23 '23 17:09 mrtnkb

Any luck reproducing this error?

mrtnkb avatar Sep 30 '23 11:09 mrtnkb

You can install from the source by pointing the pip to GitHub repo. Simsopt requires only a C++ compiler. Your workflows should not be any more complex.

Its very hard to debug these errors. But I'll check what changed in the build from v0.13

Bharat

On Sat, Sep 30, 2023, 7:38 AM mrtnkb @.***> wrote:

Any luck reproducing this error?

— Reply to this email directly, view it on GitHub https://github.com/hiddenSymmetries/simsopt/issues/352#issuecomment-1741746809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA62VEFD6LPMXOOSY5XA673X5AAEPANCNFSM6AAAAAA44KZ2OQ . You are receiving this because you were mentioned.Message ID: @.***>

mbkumar avatar Sep 30 '23 12:09 mbkumar

Hi, thanks for looking into it! Building from source works, but its too expensive for ephemeral environments unfortunately. Another data point is that the version compiled in the hiddensymmetries/simsopt docker container works fine.

mrtnkb avatar Sep 30 '23 12:09 mrtnkb

I have been able to reproduce the error on my laptop which also has an i7. This might indicate that it is an issue with the architecture.

I do not know enough about this to get any further, but I am uploading the output of lscpu on both systems so someone who does might get further.

not-working [Arch Linux]: lscpu.txt

Working [OpenSuse Leap 15.4]: lscpu.txt

smiet avatar Oct 02 '23 08:10 smiet

I did a preliminary check of what changed after v0.13.0. In v0.14.0, I pushed a lot of changes to support PowerPC. I don't see any major changes in the build process and the CMakeLists.txt that can change the architecture. However, there are some changes and then there are major changes to the C++ code. Let me do more debugging to identify the problematic part.

Bharat Medasani

On Mon, Oct 2, 2023 at 4:51 AM Chris Smiet @.***> wrote:

I have been able to reproduce the error on my laptop which also has an i7. This might indicate that it is an issue with the architecture.

I do not know enough about this to get any further, but I am uploading the output of lscpu on both systems so someone who does might get further.

not-working [Arch Linux]: lscpu.txt https://github.com/hiddenSymmetries/simsopt/files/12781123/lscpu.txt

Working [OpenSuse Leap 15.4]: lscpu.txt https://github.com/hiddenSymmetries/simsopt/files/12781116/lscpu.txt

— Reply to this email directly, view it on GitHub https://github.com/hiddenSymmetries/simsopt/issues/352#issuecomment-1742629621, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA62VEBYRTPBVRPTM6HKA4LX5J6ATANCNFSM6AAAAAA44KZ2OQ . You are receiving this because you were mentioned.Message ID: @.***>

mbkumar avatar Oct 02 '23 10:10 mbkumar