the interface functions for openmp
Definition in file tpi_openmp.c.
Go to the source code of this file.
Typedefs | |
| typedef struct SCIP_JobQueue | SCIP_JOBQUEUE |
| typedef struct SCIP_JobQueues | SCIP_JOBQUEUES |
Functions | |
| static SCIP_RETCODE | createJobQueue (int nthreads, int qsize, SCIP_Bool blockwhenfull) |
| static SCIP_RETCODE | freeJobQueue (void) |
| static void | executeJob (SCIP_JOB *job) |
| static void | jobQueueProcessJob (void) |
| static SCIP_RETCODE | jobQueueAddJob (SCIP_JOB *newjob) |
| SCIP_RETCODE | SCIPtpiSignalCondition (SCIP_CONDITION *condition) |
| SCIP_RETCODE | SCIPtpiBroadcastCondition (SCIP_CONDITION *condition) |
| SCIP_RETCODE | SCIPtpiWaitCondition (SCIP_CONDITION *condition, SCIP_LOCK *lock) |
| int | SCIPtpiGetNumThreads () |
| int | SCIPtpiGetThreadNum () |
| SCIP_RETCODE | SCIPtpiCreateJob (SCIP_JOB **job, int jobid, SCIP_RETCODE(*jobfunc)(void *args), void *jobarg) |
| int | SCIPtpiGetNewJobID (void) |
| SCIP_RETCODE | SCIPtpiSumbitJob (SCIP_JOB *job, SCIP_SUBMITSTATUS *status) |
| static SCIP_Bool | isJobRunning (int jobid) |
| static SCIP_Bool | isJobWaiting (int jobid) |
| SCIP_RETCODE | SCIPtpiCollectJobs (int jobid) |
| SCIP_RETCODE | SCIPtpiInit (int nthreads, int queuesize, SCIP_Bool blockwhenfull) |
| SCIP_RETCODE | SCIPtpiExit (void) |
| typedef struct SCIP_JobQueue SCIP_JOBQUEUE |
Definition at line 45 of file tpi_openmp.c.
| typedef struct SCIP_JobQueues SCIP_JOBQUEUES |
Definition at line 57 of file tpi_openmp.c.
|
static |
| nthreads | the number of threads |
| qsize | the queue size |
| blockwhenfull | should the queue be blocked from new jobs when full |
Definition at line 64 of file tpi_openmp.c.
References BMSallocMemory, SCIP_ALLOC, and SCIP_UNUSED.
|
static |
Definition at line 101 of file tpi_openmp.c.
|
static |
| job | the job to be executed in parallel |
Definition at line 118 of file tpi_openmp.c.
References SCIP_CALL_ABORT, SCIPtpiAcquireLock(), and SCIPtpiGetThreadNum().
|
static |
this is a job that will be executed on to process the job queue
Definition at line 163 of file tpi_openmp.c.
References SCIP_CALL_ABORT, and SCIPtpiAcquireLock().
|
static |
adding a job to the job queue. This gives some more flexibility in the handling of new jobs. IMPORTANT: This function MUST be called from within a mutex.
Definition at line 209 of file tpi_openmp.c.
References SCIP_Job::nextjob, SCIP_CALL, and SCIPtpiAcquireLock().
| SCIP_RETCODE SCIPtpiSignalCondition | ( | SCIP_CONDITION * | condition | ) |
signals one waiting thread
| condition | the condition variable to signal |
Definition at line 260 of file tpi_openmp.c.
References SCIP_CALL, SCIP_OKAY, SCIPtpiAcquireLock(), and SCIPtpiReleaseLock().
Referenced by jobQueueAddJob().
| SCIP_RETCODE SCIPtpiBroadcastCondition | ( | SCIP_CONDITION * | condition | ) |
signals all waiting threads
| condition | the condition variable to broadcast |
Definition at line 274 of file tpi_openmp.c.
References SCIP_CALL, SCIP_OKAY, SCIPtpiAcquireLock(), and SCIPtpiReleaseLock().
Referenced by freeThreadPool(), and SCIPsyncstoreFinishSync().
| SCIP_RETCODE SCIPtpiWaitCondition | ( | SCIP_CONDITION * | condition, |
| SCIP_LOCK * | lock | ||
| ) |
waits on a condition variable. The given lock must be held by the caller and will be held when this function returns.
| condition | the condition variable to wait on |
| lock | the lock that is held by the caller |
Definition at line 286 of file tpi_openmp.c.
References SCIP_CALL, SCIP_OKAY, SCIPtpiAcquireLock(), and SCIPtpiReleaseLock().
Referenced by freeThreadPool(), and SCIPsyncstoreEnsureAllSynced().
| int SCIPtpiGetNumThreads | ( | void | ) |
Returns the number of threads
Definition at line 324 of file tpi_openmp.c.
| int SCIPtpiGetThreadNum | ( | void | ) |
Returns the thread number
Definition at line 331 of file tpi_openmp.c.
Referenced by applyBoundChanges(), execConcsolver(), and executeJob().
| SCIP_RETCODE SCIPtpiCreateJob | ( | SCIP_JOB ** | job, |
| int | jobid, | ||
| SCIP_RETCODE(*)(void *args) | jobfunc, | ||
| void * | jobarg | ||
| ) |
creates a job for parallel processing
| job | pointer to the job that will be created |
| jobid | the id for the current job |
| jobfunc | pointer to the job function |
| jobarg | the job's argument |
Definition at line 338 of file tpi_openmp.c.
References BMSallocMemory, SCIP_Job::jobfunc, SCIP_Job::jobid, SCIP_ALLOC, and SCIP_OKAY.
| int SCIPtpiGetNewJobID | ( | void | ) |
get a new job id for the new set of submitted jobs
Definition at line 356 of file tpi_openmp.c.
References SCIP_Job::jobid.
| SCIP_RETCODE SCIPtpiSumbitJob | ( | SCIP_JOB * | job, |
| SCIP_SUBMITSTATUS * | status | ||
| ) |
submit a job for parallel processing
| job | pointer to the job to be submitted |
| status | pointer to store the submit status |
Definition at line 371 of file tpi_openmp.c.
|
static |
Definition at line 386 of file tpi_openmp.c.
|
static |
Definition at line 405 of file tpi_openmp.c.
| SCIP_RETCODE SCIPtpiCollectJobs | ( | int | jobid | ) |
Blocks until all jobs of the given jobid have finished and then returns the smallest SCIP_RETCODE of all the jobs
if the job has the right jobid collect its retcode, remove it from the finished job list, and free it
| jobid | the id of the jobs to collect |
Definition at line 434 of file tpi_openmp.c.
References SCIP_Job::retcode, SCIP_CALL, SCIP_OKAY, and SCIPtpiAcquireLock().
| SCIP_RETCODE SCIPtpiInit | ( | int | nthreads, |
| int | queuesize, | ||
| SCIP_Bool | blockwhenfull | ||
| ) |
initializes tpi
| nthreads | the number of threads to be used |
| queuesize | the size of the queue |
| blockwhenfull | should the queue block when full |
Definition at line 502 of file tpi_openmp.c.
| SCIP_RETCODE SCIPtpiExit | ( | void | ) |
deinitializes tpi
Definition at line 516 of file tpi_openmp.c.