-
Notifications
You must be signed in to change notification settings - Fork 270
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
BUG: Error when using CyLP #1022
Comments
Hmmm, haven't seen that error before. How large are the files you are trying to process? What OS are you using? I'll try to install using their methods to see if I can reproduce, I usually use the pip install of the python branch of jjhelmus as it seemed to usually be more stable, but confused why the compilers wouldn't have helped. |
Also, while I try to see if I can reproduce etc, I recommend possibly opening on issue on their issue tracker as well. Maybe someone else has experienced the issue as well there. |
@tanelv I'm wondering why there are two different environments involved ( If you can provide any additional details, this would help very much for diagnosing. |
Ah good catch @kmuehlbauer ! Yeah I second that as well. |
Hm, good points. The files are IRIS RAW files, around 5-10 MB each. I use CentOS 7:
The files should be OK, I used the phase_proc_lp function with CyLP on the same files on an older server (running on Scientific Linux 6.9) successfully, but our university is moving to the new HPC system and I would need to migrate to this new system. Yes, there are two environments. I first tried to get CyLP working under the |
Just to be on the safe side. It might not solve the issue, but we would know for sure then. |
Sorry for taking so long to answer. I tried to first update the current Anaconda installation, but as it stayed solving the environment for more than 6 hours I stopped it, removed Anaconda completely and installed a new Anaconda from scratch using the current latest version (https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh).
To install CyLP I followed these instructions https://github.com/coin-or/CyLP And it still hangs with the same error as before ( |
Sorry for the late response, I'm wondering if trying to older version would work. I'm not familiar with the new CyLP version, so seeing what I can find out about it, but maybe install coincbc with: |
Thanks for the suggestion. To be safe I removed the old |
The fork https://github.com/jjhelmus/CyLP/tree/py3 of CyLP has been merged into |
Here is one of the files SUR190511130002.zip (IRIS raw) |
@zssherman It would be great if we could join forces on this one. I'm interested in getting this working too. |
@kmuehlbauer Awesome, yeah that sounds like a great idea to me! I haven't been able to reproduce the specific error yet, but the code is hanging up on these files. So been digging through the code to see. Also have tried not using the multi processing version of the code to try to isolate the problem. |
@zssherman my idea is to start from the last working environment, if we could identify such. Then we could increase versions and see which one breaks. Ideally we would set this up using CI in a dedicated branch in our pyart forks. I'll try to get something running, but this might take some time. |
@kmuehlbauer Gotcha sound good! So I did try the coincbc conda-forge install with the py3 branch in python3.6 just to try anything, and I was able to run the cylp code. When I updated python and cylp is when I started to hang and any file I tried including the user's file above. The py3 branch of cylp only works for python3.6. Python3.6 is far back, so not sure how useful, but between then and now is when something changed. Whether the current kdp proccesing code doesn't handle the current changes and needs to be updated or something else is causing memory issues. I'm trying to check the coin-or-cbc as well. |
@kmuehlbauer The environment i used was: |
Thanks @zssherman for the Python 3.6 reference. I also managed to get CyLP installed in Python 3.6 and my script now runs as it should. These are the steps I took (I removed the old environment before that)
|
@zssherman Just FYI, I've recreated the Python 3.6 environment as suggested. It worked. I've created other environments for Python 3.7 /3.8 and 3.9. It looked promising first, but now nothing works, even the Python 3.6 environment doesn't work. I have to restart from scratch. I've found those interesting issues over at CyLP, which might be connected:
Also I found that we have to be careful with the cython version and we would need to recreate the cpp in any case. |
@kmuehlbauer Sorry for the late response, was on vacation. And makes sense, yeah that is helpful, thanks for finding those! Trying to think how to go about this next because it almost seems like a memory leak issue. |
As a side note, we will be having assistance on this soon and will most likely do an overhaul of the kdp processing code. |
So it looks like Google has an For example, check out this walkthrough of a mixed-integer programming problem... here is a list of the solvers available:
This package is pip installable, and works with the most recent Python versions |
@mgrover1 That's available from within conda-forge ( |
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:821893389;
mso-list-template-ids:1909733804;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:1.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level5
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level6
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level8
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level9
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->Very excited to see this happening From: Max Grover ***@***.***>Date: Monday, March 28, 2022 at 8:44 AMTo: ARM-DOE/pyart ***@***.***>Cc: Subscribed ***@***.***>Subject: Re: [ARM-DOE/pyart] Error when using CyLP (Issue #1022)So it looks like Google has an or-tools package that has the ability to access the same linear program solvers we use in cylp.For example, check out this walkthrough of a mixed-integer programming problem... here is a list of the solvers available:CLP_LINEAR_PROGRAMMING or CLPCBC_MIXED_INTEGER_PROGRAMMING or CBCGLOP_LINEAR_PROGRAMMING or GLOPBOP_INTEGER_PROGRAMMING or BOPSAT_INTEGER_PROGRAMMING or SAT or CP_SATSCIP_MIXED_INTEGER_PROGRAMMING or SCIPGUROBI_LINEAR_PROGRAMMING or GUROBI_LPGUROBI_MIXED_INTEGER_PROGRAMMING or GUROBI or GUROBI_MIPCPLEX_LINEAR_PROGRAMMING or CPLEX_LPCPLEX_MIXED_INTEGER_PROGRAMMING or CPLEX or CPLEX_MIPXPRESS_LINEAR_PROGRAMMING or XPRESS_LPXPRESS_MIXED_INTEGER_PROGRAMMING or XPRESS or XPRESS_MIPGLPK_LINEAR_PROGRAMMING or GLPK_LPGLPK_MIXED_INTEGER_PROGRAMMING or GLPK or GLPK_MIPThis package is pip installable, and works with the most recent Python versions—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
There is no shortage of Python interfaces to MIP solvers. @mkoeppe recently compiled a nice list of all the options, which it would probably be useful to have somewhere other than a ticket in Sage, but here it is: https://trac.sagemath.org/ticket/26511#comment:56 I believe By the way, I'm not sure if you guys saw it, but @mkoeppe and I just finished some major improvements to CyLP and there are now binary wheels for all platforms, dramatically simplifying installation (no need to install Cbc, see here). Whether you continue with CyLP or not, I'm still interested in tracking down this bug. |
@tkralphs thank for your response - as someone who is new to MIP solvers, I appreciate your insight on the Python MIP interfaces and your work on CyLP. The main reason for looking into alternatives was the requirement to use Python 3.6, which was causing issues with installing the rest of the environment we use for PyART. That is fantastic news about the improved installation steps! I just tried it out with a Python 3.9 environment, and it worked beautifully. Happy to provide feedback where we can, and again, thanks for all your work with CyLP. |
Just to be clear, CyLP works with any version of Python. I am using it with Python 3.10. I think the Python 3.6 "requirement" came from the fact that installing it in 3.6 seemed to overcome the particular bug reported here for some reason, but I think the situation is not at all clear at this point. Some more digging is needed. If someone could try to replicate this issue with the new wheels, that would be helpful. Perhaps that will fix the bug somehow. |
Using the new build files, I am still seeing the following when running our example using Processing Code: import numpy as np
import matplotlib.pyplot as plt
import pyart
from pyart.testing import get_test_data
file = get_test_data('095636.mdv')
# perform LP phase processing (this takes a while)
radar = pyart.io.read_mdv(file)
# the next line force only the first sweep to be processed, this
# significantly speeds up the calculation but should be commented out
# in production so that the entire volume is processed
radar = radar.extract_sweeps([0])
phidp, kdp = pyart.correct.phase_proc_lp(radar, 0.0, debug=True) Error: Exec time: 0.5900969505310059
Doing 0
python(43345,0x117afc600) malloc: *** error for object 0x7f7fad9c6660: pointer being freed was not allocated
python(43345,0x117afc600) malloc: *** set a breakpoint in malloc_error_break to debug |
@tkralphs we are running into the same issue described in coin-or/CyLP#138 I believe... |
OK, thanks, I will try to find some time to build a version of CyLP and Cbc with debugging symbols, so that I can see exactly where this error is occurring. |
It looks like printing the array returned by CyLP works: print(solution)
[[ 2.34766422 2.43061544 3.18696968 ... 34.95957546 34.96160985
34.96285309]
...
[ 0.66390759 0.88923667 1.24627207 ... 27.49033571 27.46688439
27.41206319]
[ 0.90856286 1.30960192 1.81392097 ... 32.86643274 32.86900836
32.87058235] It is a <class 'numpy.ndarray'> and we can take the mean of this array 37.23997104342368 but when we assign some variable to this solution in the function python(63892,0x10f9fa600) malloc: *** error for object 0x7fe6d3f50660: pointer being freed was not allocated
python(63892,0x10f9fa600) malloc: *** set a breakpoint in malloc_error_break to debug |
@tkralphs following up - have you had a chance to look at the build error here? |
@tanelv I have the same problem as you, but after following your steps to install CYLP, it reports an error when running the test code: Processing Code: Error: In addition to using pip install git+https://github.com/jjhelmus/CyLP.git@py3 to install cylp-0.7.4, whether you also do other configuration? |
@zssherman I encountered the same problem and rolled back to CYLP-0.7.4 as follows:
but in cyLP-0.7.4, the most basic function imports reported an error : So if I want to run this function successfully now :
How should I configure my CyLP and Pyart environments? Looking forward to your reply! |
@mole-bai - we are working on replacing the CyLP solver in Py-ART. You can use one of the other solvers ( We apologize that we are not able to support solving this CyLP issue. |
After finally managing to successfully install CyLP, using it in phase_proc_lp (pyart.correct.phase_proc_lp(radar, 2.0, self_const = 12000.0, low_z=0.0, high_z=53.0, min_phidp=0.01, min_ncp=0.3, min_rhv=0.8, LP_solver='cylp_mp', proc=15)) does not work. The error seems to be
"Error in `python': free(): invalid pointer: 0x00005597c77d6c98"
A long list of messages and memory map is being printed out:
cylp_messages.txt And then the script just hangs.
I installed CyLP following these instructions https://github.com/coin-or/CyLP
I tried also installing CyLP following these instructions provided in the Py-ART documentation https://arm-doe.github.io/pyart/setting_up_an_environment.html but unsuccessfully. I got what looked like compiling issues even after installing additional conda compilers. So the original CyLP installation instructions worked, but for some reason the phase_proc_lp function is not working still.
The text was updated successfully, but these errors were encountered: