JoeyDelp / JoSIM

Superconductor Circuit Simulator
MIT License
78 stars 35 forks source link

Issue with installation #87

Closed EmilRizvanov closed 1 year ago

EmilRizvanov commented 1 year ago

Hi Joey,

I have tried installing the JoSIM, but the system displays the error in the stage of "Building CXX object CMakeFiles/josim.dir/src/Simulation.cpp.o".

error

I work on Ubuntu 22.04.1 LTS with gcc 11.3.0 and cmake 3.22.1. I also tried to install it with gcc 8 and specified that I use C++17: cmake .. -DCMAKE_CXX_FLAGS="--std=c++17"; but it didn't help.

Sincerely, Emil

JoeyDelp commented 1 year ago

Good day Emil,

I am aware of this issue. It is localized to gcc and has to do with data type interpretation. I have a fix for it but that then breaks the SuperLU implementation.

I will implement the alternative whereby the build itself will be either KLU or SLU and will be defined by a setting at compile time. This will take some time to implement due to other workloads.

In the meantime here is a workaround specific to GCC version.

Alter the following lines of the Simulation.cpp file:

31     Symbolic_ = klu_l_analyze(mObj.rp.size() - 1, &mObj.rp.front(),
                                &mObj.ci.front(), &Common_);
->     Symbolic_ = klu_l_analyze(mObj.rp.size() - 1, reinterpret_cast<int64_t*>(&mObj.rp.front()),
                                reinterpret_cast<int64_t*>(&mObj.ci.front()), &Common_);

33      Numeric_ = klu_l_factor(&mObj.rp.front(), &mObj.ci.front(),
                              &mObj.nz.front(), Symbolic_, &Common_);
->     Numeric_ = klu_l_factor(reinterpret_cast<int64_t*>(&mObj.rp.front()), reinterpret_cast<int64_t*>(&mObj.ci.front()),
                              &mObj.nz.front(), Symbolic_, &Common_);

187      Numeric_ = klu_l_factor(&mObj.rp.front(), &mObj.ci.front(),
                              &mObj.nz.front(), Symbolic_, &Common_);
->       Numeric_ = klu_l_factor(reinterpret_cast<int64_t*>(&mObj.rp.front()), reinterpret_cast<int64_t*>(&mObj.ci.front()),
                              &mObj.nz.front(), Symbolic_, &Common_);

Hope this helps until I push an official fix.

Best regards, Joey

EmilRizvanov commented 1 year ago

It helped. Thank you very much!