Changeset 663 for branches


Ignore:
Timestamp:
Jul 3, 2007 4:51:49 AM (12 years ago)
Author:
forrest
Message:

for parallel

Location:
branches/devel/Cbc/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Cbc/src/CbcModel.cpp

    r662 r663  
    14881488          locked = false;
    14891489          pthread_cond_signal(threadInfo[iThread].condition2); // unlock in case
    1490 #define CONDITION_WAIT
    1491 #ifdef CONDITION_WAIT
    14921490          while (true) {
    14931491            pthread_mutex_lock(&condition_mutex);
     
    15071505            if (threadInfo[iThread].returnCode!=0)
    15081506              break;
     1507            pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    15091508          }
    1510 #else
    1511           while (threadInfo[iThread].returnCode==0) {
    1512             struct timespec moreTime;
    1513             moreTime.tv_nsec = 10000;
    1514             moreTime.tv_sec = 0;
    1515             nanosleep(&moreTime,NULL);
    1516           }
    1517 #endif
    15181509          threadModel[iThread]->moveToModel(this,1);
    15191510          assert (threadInfo[iThread].returnCode==1);
     
    21862177          bool finished=false;
    21872178          while (!finished) {
    2188 #ifdef CONDITION_WAIT
    21892179            pthread_mutex_lock(&condition_mutex);
    21902180            struct timespec absTime;
     
    22012191            timeWaiting += time2-time;
    22022192            pthread_mutex_unlock(&condition_mutex);
    2203 #else
    2204             struct timespec moreTime;
    2205             moreTime.tv_nsec = 100;
    2206             moreTime.tv_sec = 0;
    2207             nanosleep(&moreTime,NULL);
    2208 #endif
    22092193            for (iThread=0;iThread<numberThreads_;iThread++) {
    22102194              if (threadInfo[iThread].returnCode>0) {
     
    49154899                break;
    49164900              } else if (threadInfo[iThread].returnCode==0) {
    4917 #ifdef CONDITION_WAIT
    49184901                pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    4919 #endif
    49204902              }
    49214903            }
    49224904            while (!finished) {
    4923 #ifdef CONDITION_WAIT
    49244905              pthread_mutex_lock(&condition_mutex);
    49254906              struct timespec absTime;
     
    49324913              pthread_cond_timedwait(&condition_main,&condition_mutex,&absTime);
    49334914              pthread_mutex_unlock(&condition_mutex);
    4934 #else
    4935               struct timespec moreTime;
    4936               moreTime.tv_nsec = 100;
    4937               moreTime.tv_sec = 0 ;
    4938               nanosleep(&moreTime,NULL);
    4939 #endif
    49404915              for (iThread=0;iThread<numberThreads_;iThread++) {
    49414916                if (threadInfo[iThread].returnCode>0) {
     
    49434918                  break;
    49444919                } else if (threadInfo[iThread].returnCode==0) {
    4945 #ifdef CONDITION_WAIT
    49464920                  pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    4947 #endif
    49484921                }
    49494922              }
     
    49554928            // allow to start
    49564929            threadInfo[iThread].returnCode=0;
    4957 #ifdef CONDITION_WAIT
    49584930            pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    4959 #endif
    49604931          }
    49614932        }
     
    49644935          if (threadInfo[iThread].returnCode==0) {
    49654936            bool finished=false;
    4966 #ifdef CONDITION_WAIT
    49674937            pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    4968 #endif
    49694938            while (!finished) {
    4970 #ifdef CONDITION_WAIT
    49714939              pthread_mutex_lock(&condition_mutex);
    49724940              struct timespec absTime;
     
    49794947              pthread_cond_timedwait(&condition_main,&condition_mutex,&absTime);
    49804948              pthread_mutex_unlock(&condition_mutex);
    4981 #else
    4982               struct timespec moreTime;
    4983               moreTime.tv_nsec = 100;
    4984               moreTime.tv_sec = 0;
    4985               nanosleep(&moreTime,NULL);
    4986 #endif
    49874949              if (threadInfo[iThread].returnCode>0) {
    49884950                finished=true;
    49894951                break;
    49904952              } else if (threadInfo[iThread].returnCode==0) {
    4991 #ifdef CONDITION_WAIT
    49924953                pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    4993 #endif
    49944954              }
    49954955            }
     
    1069910659      stuff->returnCode=1;
    1070010660      //printf("end node %x\n",stuff->node);
    10701 #ifdef CONDITION_WAIT
    1070210661      threadStruct * stuffMain = (threadStruct *) baseModel->mutex();
    1070310662      //pthread_mutex_t * condition_mutex = stuffMain->mutex2;
    1070410663      pthread_cond_t * condition_main = stuffMain->condition2;
    1070510664      pthread_cond_signal(condition_main); // unlock
    10706 #endif
    1070710665      pthread_mutex_unlock(mutex);
    1070810666      stuff->timeInThread += CoinCpuTime()-time2;
     
    1073910697      stuff->returnCode=1;
    1074010698      //printf("end node %x\n",stuff->node);
    10741 #ifdef CONDITION_WAIT
    1074210699      threadStruct * stuffMain = (threadStruct *) baseModel->mutex();
    1074310700      //pthread_mutex_t * condition_mutex = stuffMain->mutex2;
    1074410701      pthread_cond_t * condition_main = stuffMain->condition2;
    1074510702      pthread_cond_signal(condition_main); // unlock
    10746 #endif
    1074710703      pthread_mutex_unlock(mutex);
    1074810704    } else {
  • branches/devel/Cbc/src/CbcSolver.cpp

    r662 r663  
    14761476      solver->setDblParam(OsiObjOffset,info.offset);
    14771477      // Set integer variables
    1478       for (int i=info.numberColumns-info.numberBinary-info.numberIntegers;
     1478      for (int i=info.numberColumns-info.numberIntegers;
    14791479           i<info.numberColumns;i++)
    14801480        solver->setInteger(i);
Note: See TracChangeset for help on using the changeset viewer.