72 assert(nthreads >= 0);
105 assert(_jobqueues != NULL);
215 assert(newjob != NULL);
252 #pragma omp task firstprivate(newjob) 261 SCIP_CONDITION* condition
266 if( condition->_waitnum > condition->_signals )
267 ++condition->_signals;
275 SCIP_CONDITION* condition
280 condition->_signals = condition->_waitnum;
287 SCIP_CONDITION* condition,
296 waitnum = ++condition->_waitnum;
298 ++condition->_waiters;
303 #pragma omp taskyield 306 while( condition->_signals < waitnum );
308 --condition->_waiters;
310 if( condition->_waiters == 0 )
312 condition->_signals = 0;
313 condition->_waitnum = 0;
327 return omp_get_num_threads();
334 return omp_get_thread_num();
347 (*job)->jobid =
jobid;
349 (*job)->args = jobarg;
350 (*job)->nextjob = NULL;
360 static int currentjobid = 0;
363 #pragma omp atomic capture 364 jobid = ++currentjobid;
377 assert(_jobqueues != NULL);
394 for( i = 0; i < _jobqueues->
nthreads; ++i )
417 if( currjob->
jobid == jobid )
456 if( currjob->
jobid == jobid )
462 retcode = MIN(retcode, currjob->
retcode);
508 omp_set_num_threads(nthreads);
509 assert(_jobqueues == NULL);
520 assert(_jobqueues != NULL);
enum SCIP_Submitstatus SCIP_SUBMITSTATUS
SCIP_RETCODE SCIPtpiCreateJob(SCIP_JOB **job, int jobid, SCIP_RETCODE(*jobfunc)(void *args), void *jobarg)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPtpiAcquireLock(SCIP_LOCK *lock)
#define BMSallocMemoryArray(ptr, num)
SCIP_RETCODE SCIPtpiInitCondition(SCIP_LOCK *lock)
SCIP_RETCODE SCIPtpiCollectJobs(int jobid)
static SCIP_Bool isJobRunning(int jobid)
SCIP_RETCODE SCIPtpiInit(int nthreads, int queuesize, SCIP_Bool blockwhenfull)
#define BMSfreeMemory(ptr)
static void jobQueueProcessJob(void)
static SCIP_RETCODE createJobQueue(int nthreads, int qsize, SCIP_Bool blockwhenfull)
static SCIP_RETCODE jobQueueAddJob(SCIP_JOB *newjob)
int SCIPtpiGetThreadNum()
SCIP_RETCODE SCIPtpiSignalCondition(SCIP_CONDITION *condition)
#define BMSfreeMemoryArray(ptr)
SCIP_RETCODE SCIPtpiReleaseLock(SCIP_LOCK *lock)
the type definitions for the SCIP parallel interface
struct SCIP_Job * nextjob
SCIP_RETCODE SCIPtpiExit(void)
SCIP_RETCODE SCIPtpiSumbitJob(SCIP_JOB *job, SCIP_SUBMITSTATUS *status)
static SCIP_Bool isJobWaiting(int jobid)
SCIP_RETCODE SCIPtpiInitLock(SCIP_LOCK *lock)
SCIP_CONDITION jobfinished
void SCIPtpiDestroyLock(SCIP_LOCK *lock)
void SCIPtpiDestroyCondition(SCIP_LOCK *lock)
int SCIPtpiGetNumThreads()
#define BMSallocMemory(ptr)
SCIP_RETCODE(* jobfunc)(void *args)
SCIP_RETCODE SCIPtpiBroadcastCondition(SCIP_CONDITION *condition)
SCIP_RETCODE SCIPtpiWaitCondition(SCIP_CONDITION *condition, SCIP_LOCK *lock)
static void executeJob(SCIP_JOB *job)
#define SCIP_CALL_ABORT(x)
int SCIPtpiGetNewJobID(void)
static SCIP_RETCODE freeJobQueue(void)
SCIP_JOBQUEUE finishedjobs
memory allocation routines