[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Error detected in file glplib10.c at line 109

From: Antonello Lobianco
Subject: Re: [Help-glpk] Error detected in file glplib10.c at line 109
Date: Wed, 2 Dec 2009 10:39:15 +0100

Hello, I created a test case where I apply a loop over a SINGLE working thread that solves the LP example and I still have the issue.

Now I don't know if the problem is (in inverted order of estimated likelihood):
1) in my code;
2) in the Qt thread library;
3) in glpk;
4) somewhere in the compiler (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8) )

The code is downloadable at but busically the core is:

#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <glpk.h>
#include <Thread.h>

using namespace std;

int main(int argc, char *argv[]){

    cout << "Test on a glpk application using Qt Threads" << endl<<endl;

    Thread wThread;  // Thread is a subclass of QThread
    for (uint y=0;y<500;y++){
        bool assigned = false;
        while(!assigned) {
            if (!wThread.isRunning()){
                wThread.start(); // job done from the other thread.. just solve the glpk LP example
                assigned = true;
    cout <<"All done without errors (crashing)"<<endl;

    return 0;


On Fri, Nov 20, 2009 at 5:49 AM, Andrew Makhorin <address@hidden> wrote:
>     I am trying to parallelise the Qt/C++ code of  multi agent model
> representing farmers.
> For the time being I #39;m using only 1 thread as I got from this
> list that glpk is, at the present time, not  re-entrant.
> The funny(!) side is that when I use the new code (see down), even
> if it use only **1** working threads, the unpatched version of glpk
> crash.
> I used then the doc example and I was able to receive the following error message when crashing:
> Assertion failed: xlcmp(env->t_last, t) <= 0
> Error detected in file glplib10.c at line 109

> Is it a glpk bug or something I am doing seriously very wrong ??

I don't think it is a glpk bug. Something unpredictable occured,
because original glpk code is not re-enterable.

You can make glpk re-enterable by replacing src/glplib02.c with a
re-enterable version (for details see comments). However, glpk has
no synchronization features, so the same problem object must not be
used in different threads.

Antonello Lobianco
Assegnista di Ricerca
Dipartimento di Economia, Università Politecnica delle Marche
Progetto "RegMAS per il Piceno" (Fondazione CARISAP)
Tel: +39.071.2207116
Email: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]